Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 20, 2014, 3:46:06 PM (11 years ago)
Author:
noep
Message:

A Pawn being hit now prints it's Collisionshape-Structure, as well as the WorldEntity every on of those CollisionShapes belongs to.

Location:
code/branches/modularships
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/modularships/data/levels/emptyLevel.oxw

    r10001 r10003  
    6363                </collisionShapes>
    6464            </StaticEntity>
     65            <StaticEntity position="0,-180,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     66                <attached>
     67                    <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
     68                    <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
     69                </attached>
     70                <collisionShapes>
     71                    <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
     72                    <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
     73                </collisionShapes>
     74            </StaticEntity>
    6575        </attached>
    6676        <collisionShapes>
  • code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r9997 r10003  
    3939#include "core/XMLPort.h"
    4040#include "tools/BulletConversions.h"
     41
     42#include "collisionshapes/WorldEntityCollisionShape.h"
    4143
    4244namespace orxonox
     
    118120            this->updatePublicShape();
    119121        }
     122
     123        // If the shape to be attached is not a CompoundCollisionShape (thus an actual physical shape) & this is a WorldEntity's CollisionShape,
     124        // set it's userPointer to the WorldEntity this CompoundCollisionShape belongs to.
     125        if (!orxonox_cast<CompoundCollisionShape*>(shape) && orxonox_cast<WorldEntityCollisionShape*>(this))
     126            shape->getCollisionShape()->setUserPointer(orxonox_cast<WorldEntityCollisionShape*>(this)->getWorldEntityOwner());
    120127    }
    121128
  • code/branches/modularships/src/orxonox/worldentities/WorldEntity.cc

    r9667 r10003  
    4646#include "Scene.h"
    4747#include "collisionshapes/WorldEntityCollisionShape.h"
     48#include <BulletCollision/CollisionShapes/btCollisionShape.h>
    4849
    4950namespace orxonox
  • code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc

    r10002 r10003  
    630630        // e.g. "Box 4 is WorldEntityCollisionShape 0x126dd060"
    631631        orxout() << "  " << this->getRadarName() << " is WorldEntityCollisionShape* " << ownWECS << endl;
    632         // e.g. "Box 4 is btCollisionShape 0x126dd060"
    633         orxout() << "  " << this->getRadarName() << " is btCollisionShape* " << ownWECS->getCollisionShape() << endl;
     632        // e.g. "Box 4 is WorldEntity 0x126dd060"
     633        orxout() << "  " << this->getRadarName() << " is WorldEntity* " << this << endl;
    634634        // e.g. "Box 4 is objectID 943"
    635635        orxout() << "  " << this->getRadarName() << " is objectID " << this->getObjectID() << endl;
     636
     637        // List all attached Objects
     638        orxout() << "  " << this->getRadarName() << " has the following Objects attached:" << endl;
     639        for (int i=0; i<10; i++)
     640            orxout() << " " << i << ": " << this->getAttachedObject(i) << endl;
    636641
    637642        // print child shapes of this WECS
    638643        // printChildShapes(ownWECS, 2, 0);
    639644        printBtChildShapes((btCompoundShape*)(ownWECS->getCollisionShape()), 2, 0);
    640         // printChildShapeMap(ownWECS->getShapesMap());
    641645
    642646
     
    715719            printSpaces(indent+2);  orxout() << "- " << i << " - - -" << endl;
    716720
    717             // For each childshape, print:
    718 
    719             // pointer to the btCollisionShape
    720             printSpaces(indent+2);  orxout() << "btCollisionShape*: " << cs->getChildShape(i) << endl;
     721            // For each childshape, print: (as long as it's not another CompoundCollisionShape)
     722            if (!orxonox_cast<btCompoundShape*>(cs->getChildShape(i)))
     723            {
     724                // pointer to the btCollisionShape
     725                printSpaces(indent+2);  orxout() << "btCollisionShape*: " << cs->getChildShape(i) << endl;
     726
     727                // pointer to the btCollisionShape
     728                printSpaces(indent+2);  orxout() << "m_userPointer*: " << cs->getChildShape(i)->getUserPointer() << endl;
     729            }
    721730
    722731            // if the childshape is a CompoundCollisionShape, print its children.
    723732            if (cs->getChildShape(i)->isCompound())
    724             {
    725                 printSpaces(indent+2);  orxout() << "This shape is compound." << endl;
    726733                printBtChildShapes((btCompoundShape*)(cs->getChildShape(i)), indent+2, i);
    727             }
    728 
    729         }
    730     }
    731 
    732     void Pawn::printChildShapeMap(std::map<CollisionShape*, btCollisionShape*> map)
    733     {
    734         orxout() << endl;
     734
     735        }
    735736    }
    736737
  • code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h

    r10002 r10003  
    236236            void printBtChildShapes(btCompoundShape* cs, int indent, int subshape);
    237237            void printSpaces(int num);
    238             void printChildShapeMap(std::map<CollisionShape*, btCollisionShape*> map);
    239238
    240239        private:
Note: See TracChangeset for help on using the changeset viewer.