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/src/orxonox/worldentities/pawns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.