Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 13, 2014, 3:52:23 PM (11 years ago)
Author:
noep
Message:

Tried (and failed) to fix output of CollisionShape-structure

Location:
code/branches/modularships
Files:
5 edited

Legend:

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

    r9997 r10001  
    4949    </MovableEntity>
    5050   
    51     <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,0" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Box 4" >
     51    <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,-100" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Pawn 0" >
    5252        <attached>
    53             <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
    54             <Model position="0,-30,0" mesh="cube.mesh" scale3D="15,15,15" />
    55             <StaticEntity position="0,-60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     53            <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
     54            <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
     55            <StaticEntity position="0,-120,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
    5656                <attached>
    57                     <Model position="0,0,0" mesh="cube.mesh" scale3D="15,15,15" />
    58                     <Model position="0,0,30" mesh="cube.mesh" scale3D="15,15,15" />
     57                    <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
     58                    <Model position="0,0,60" mesh="cube.mesh" scale3D="30,30,30" />
    5959                </attached>
    6060                <collisionShapes>
    61                     <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
    62                     <BoxCollisionShape position="0,0,30" halfExtents="15,15,15" />
     61                    <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
     62                    <BoxCollisionShape position="0,0,60" halfExtents="30,30,30" />
    6363                </collisionShapes>
    6464            </StaticEntity>
    6565        </attached>
    6666        <collisionShapes>
    67             <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
    68             <BoxCollisionShape position="0,-30,0" halfExtents="15,15,15" />
     67            <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
     68            <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
     69        </collisionShapes>
     70    </Pawn>
     71
     72    <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,100" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Pawn 1" >
     73        <attached>
     74            <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
     75            <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
     76        </attached>
     77        <collisionShapes>
     78            <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
     79            <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
    6980        </collisionShapes>
    7081    </Pawn>
  • code/branches/modularships/src/orxonox/collisionshapes/CollisionShape.h

    r9997 r10001  
    170170            void notifyDetached(); // Notifies the CollisionShape of being detached from a CompoundCollisionShape.
    171171
    172             inline unsigned int getparentID()
     172            inline unsigned int getParentID()
    173173                { return this->parentID_; }
     174
     175            inline CompoundCollisionShape* getParent()
     176                { return this->parent_; }
    174177
    175178        protected:
  • code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.h

    r9997 r10001  
    7373            int getNumChildShapes();
    7474
     75            inline std::map<CollisionShape*, btCollisionShape*> getShapesMap()
     76            {
     77                return attachedShapes_;
     78            }
     79
    7580        private:
    7681            void updatePublicShape();
  • code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc

    r9997 r10001  
    5151
    5252#include "collisionshapes/WorldEntityCollisionShape.h"
     53#include <BulletCollision/CollisionShapes/btCollisionShape.h>
    5354
    5455namespace orxonox
     
    278279    void Pawn::customDamage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
    279280    {
     281        orxout() << "damage(): Collision detected on " << this->getRadarName() << ", btCS*: " << cs << endl;
     282
    280283        int collisionShapeIndex = this->isMyCollisionShape(cs);
    281284        orxout() << collisionShapeIndex << endl;
     
    284287        if (originator)
    285288            damage *= originator->getDamageMultiplier();
    286 
    287         orxout() << "damage(): Custom collision detected on " << this->getRadarName() << ", CS: " << cs << endl;
    288289
    289290        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
     
    624625
    625626        // e.g. "Box 4: Searching for CS 0x1ad49200"
    626         orxout() << this->getRadarName() << ": Searching for CS " << cs << endl;
     627        orxout() << this->getRadarName() << ": Searching for btCS* " << cs << endl;
    627628        // e.g. "Box 4 is WorldEntityCollisionShape 0x126dd060"
    628         orxout() << "  " << this->getRadarName() << " is WorldEntityCollisionShape " << ownWECS << endl;
     629        orxout() << "  " << this->getRadarName() << " is WorldEntityCollisionShape* " << ownWECS << endl;
     630        // e.g. "Box 4 is btCollisionShape 0x126dd060"
     631        orxout() << "  " << this->getRadarName() << " is btCollisionShape* " << ownWECS->getCollisionShape() << endl;
    629632        // e.g. "Box 4 is objectID 943"
    630633        orxout() << "  " << this->getRadarName() << " is objectID " << this->getObjectID() << endl;
    631634
    632635        // print child shapes of this WECS
    633         printChildShapes(ownWECS, 2, 0);
     636        // printChildShapes(ownWECS, 2, 0);
     637        printChildShapeMap(ownWECS->getShapesMap());
     638
    634639
    635640        // end
     
    640645    void Pawn::printChildShapes(CompoundCollisionShape* cs, int indent, int subshape)
    641646    {
     647        for (int i=0; i < cs->getNumChildShapes(); i++)
     648        {
     649            orxout() << "" << endl;
     650        }
     651        /*
    642652        // e.g. "  Childshape 1 (WECS 0x126dc8c0) has 2 childshapes:"
    643         printSpaces(indent);  orxout() << "Childshape " << subshape << " (WECS " << cs << ") has " << cs->getNumChildShapes() << " childshapes:" << endl;
     653        printSpaces(indent);  orxout() << "Childshape " << subshape << " (CS* " << cs << ") has " << cs->getNumChildShapes() << " childshapes:" << endl;
     654
     655        // e.g. "Box 4 is WorldEntityCollisionShape 0x126dd060"
     656        printSpaces(indent);  orxout() << "Childshape " << subshape << " is btCollisionShape* " << cs->getCollisionShape() << endl;
    644657
    645658        for (int i=0; i < cs->getNumChildShapes(); i++)
    646659        {
     660            printSpaces(indent+2);  orxout() << "- " << i << " - - -" << endl;
     661            printSpaces(indent+2);  orxout() << "This Shape is a ";
     662            if (orxonox_cast<WorldEntityCollisionShape*>(cs->getAttachedShape(i)))
     663                orxout() << "WECS ";
     664            if (orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i)))
     665                orxout() << "CCS ";
     666            if (orxonox_cast<CollisionShape*>(cs->getAttachedShape(i)))
     667                orxout() << "CS ";
     668            orxout() << endl;
     669
    647670            // For each childshape, print:
     671
     672            // parentID of the CollisionShape
     673            printSpaces(indent+2);  orxout() << "ParentID: " << cs->getAttachedShape(i)->getObjectID() << endl;
     674
     675            // parentID of the CollisionShape
     676            printSpaces(indent+2);  orxout() << "ParentID: " << cs->getAttachedShape(i)->getParentID() << endl;
     677
     678            // parent of the CollisionShape
     679            printSpaces(indent+2);  orxout() << "ParentCCS*: " << cs->getAttachedShape(i)->getParent() << endl;
     680
    648681            // pointer to the btCollisionShape
    649             printSpaces(indent+2);  orxout() << "Bt-Childshape " << i << ": " << cs->getAttachedShape(i)->getCollisionShape() << endl;
     682            printSpaces(indent+2);  orxout() << "btCollisionShape*: " << cs->getAttachedShape(i)->getCollisionShape() << endl;
    650683
    651684            // pointer to the CollisionShape
    652             printSpaces(indent+2);  orxout() << "Orx-Childshape " << i << ": " << cs->getAttachedShape(i) << endl;
    653 
    654             // parentID of the CollisionShape
    655             printSpaces(indent+2);  orxout() << "ParentID of CS " << i << ": " << cs->getAttachedShape(i)->getparentID() << endl;
     685            printSpaces(indent+2);  orxout() << "CollisionShape*: " << cs->getAttachedShape(i) << endl;
     686
     687            if (cs->getAttachedShape(i)->getCollisionShape() != NULL)
     688            {
     689                // pointer to the user of the btCollisionShape
     690                printSpaces(indent+2);  orxout() << "bt: getUserPointer: " << cs->getAttachedShape(i)->getCollisionShape()->getUserPointer() << endl;
     691
     692                //
     693                printSpaces(indent+2);  orxout() << "bt: isCompound: " << cs->getAttachedShape(i)->getCollisionShape()->isCompound() << endl;
     694            }
    656695
    657696            // if the childshape is a CompoundCollisionShape, print its children.
     
    660699                printChildShapes((CompoundCollisionShape*)(cs->getAttachedShape(i)), indent+2, i);
    661700            }
    662         }
     701            */
     702        }
     703    }
     704
     705    void Pawn::printChildShapeMap(std::map<CollisionShape*, btCollisionShape*> map)
     706    {
     707        orxout() << endl;
    663708    }
    664709
  • code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h

    r9997 r10001  
    235235            void printChildShapes(CompoundCollisionShape* cs, int indent, int subshape);
    236236            void printSpaces(int num);
     237            void printChildShapeMap(std::map<CollisionShape*, btCollisionShape*> map);
    237238
    238239        private:
Note: See TracChangeset for help on using the changeset viewer.