Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 19, 2014, 4:07:48 PM (11 years ago)
Author:
noep
Message:

Output (printing) of CollisionShape-Structure now works. It uses the btCompoundShape-structure instead of the (Orxonox)CompoundCollisionShape

Location:
code/branches/modularships/src/orxonox/worldentities/pawns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc

    r10001 r10002  
    5252#include "collisionshapes/WorldEntityCollisionShape.h"
    5353#include <BulletCollision/CollisionShapes/btCollisionShape.h>
     54#include <BulletCollision/CollisionShapes/btCompoundShape.h>
     55
    5456
    5557namespace orxonox
     
    635637        // print child shapes of this WECS
    636638        // printChildShapes(ownWECS, 2, 0);
    637         printChildShapeMap(ownWECS->getShapesMap());
     639        printBtChildShapes((btCompoundShape*)(ownWECS->getCollisionShape()), 2, 0);
     640        // printChildShapeMap(ownWECS->getShapesMap());
    638641
    639642
     
    699702                printChildShapes((CompoundCollisionShape*)(cs->getAttachedShape(i)), indent+2, i);
    700703            }
    701             */
     704
     705        }*/
     706    }
     707
     708    void Pawn::printBtChildShapes(btCompoundShape* cs, int indent, int subshape)
     709    {
     710        // e.g. "  Childshape 1 (WECS 0x126dc8c0) has 2 childshapes:"
     711        printSpaces(indent);  orxout() << "Childshape " << subshape << " (btCS* " << cs << ") has " << cs->getNumChildShapes() << " childshapes:" << endl;
     712
     713        for (int i=0; i < cs->getNumChildShapes(); i++)
     714        {
     715            printSpaces(indent+2);  orxout() << "- " << i << " - - -" << endl;
     716
     717            // For each childshape, print:
     718
     719            // pointer to the btCollisionShape
     720            printSpaces(indent+2);  orxout() << "btCollisionShape*: " << cs->getChildShape(i) << endl;
     721
     722            // if the childshape is a CompoundCollisionShape, print its children.
     723            if (cs->getChildShape(i)->isCompound())
     724            {
     725                printSpaces(indent+2);  orxout() << "This shape is compound." << endl;
     726                printBtChildShapes((btCompoundShape*)(cs->getChildShape(i)), indent+2, i);
     727            }
     728
    702729        }
    703730    }
     
    708735    }
    709736
    710     void Pawn::printSpaces(int number)
    711     {
    712         for(int i=0; i<number; i++)
     737    void Pawn::printSpaces(int num)
     738    {
     739        for(int i=0; i<num; i++)
    713740            orxout() << " ";
    714741    }
  • code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h

    r10001 r10002  
    234234            virtual int isMyCollisionShape(const btCollisionShape* cs);
    235235            void printChildShapes(CompoundCollisionShape* cs, int indent, int subshape);
     236            void printBtChildShapes(btCompoundShape* cs, int indent, int subshape);
    236237            void printSpaces(int num);
    237238            void printChildShapeMap(std::map<CollisionShape*, btCollisionShape*> map);
Note: See TracChangeset for help on using the changeset viewer.