[Orxonox-commit 5339] r10002 - code/branches/modularships/src/orxonox/worldentities/pawns

noep at orxonox.net noep at orxonox.net
Wed Mar 19 16:07:48 CET 2014


Author: noep
Date: 2014-03-19 16:07:48 +0100 (Wed, 19 Mar 2014)
New Revision: 10002

Modified:
   code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
   code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
Log:
Output (printing) of CollisionShape-Structure now works. It uses the btCompoundShape-structure instead of the (Orxonox)CompoundCollisionShape

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc	2014-03-13 14:52:23 UTC (rev 10001)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc	2014-03-19 15:07:48 UTC (rev 10002)
@@ -51,7 +51,9 @@
 
 #include "collisionshapes/WorldEntityCollisionShape.h"
 #include <BulletCollision/CollisionShapes/btCollisionShape.h>
+#include <BulletCollision/CollisionShapes/btCompoundShape.h>
 
+
 namespace orxonox
 {
     RegisterClass(Pawn);
@@ -634,7 +636,8 @@
 
         // print child shapes of this WECS
         // printChildShapes(ownWECS, 2, 0);
-        printChildShapeMap(ownWECS->getShapesMap());
+        printBtChildShapes((btCompoundShape*)(ownWECS->getCollisionShape()), 2, 0);
+        // printChildShapeMap(ownWECS->getShapesMap());
 
 
         // end
@@ -698,7 +701,31 @@
             {
                 printChildShapes((CompoundCollisionShape*)(cs->getAttachedShape(i)), indent+2, i);
             }
-            */
+
+        }*/
+    }
+
+    void Pawn::printBtChildShapes(btCompoundShape* cs, int indent, int subshape)
+    {
+        // e.g. "  Childshape 1 (WECS 0x126dc8c0) has 2 childshapes:"
+        printSpaces(indent);  orxout() << "Childshape " << subshape << " (btCS* " << cs << ") has " << cs->getNumChildShapes() << " childshapes:" << endl;
+
+        for (int i=0; i < cs->getNumChildShapes(); i++)
+        {
+            printSpaces(indent+2);  orxout() << "- " << i << " - - -" << endl;
+
+            // For each childshape, print:
+
+            // pointer to the btCollisionShape
+            printSpaces(indent+2);  orxout() << "btCollisionShape*: " << cs->getChildShape(i) << endl;
+
+            // if the childshape is a CompoundCollisionShape, print its children.
+            if (cs->getChildShape(i)->isCompound())
+            {
+                printSpaces(indent+2);  orxout() << "This shape is compound." << endl;
+                printBtChildShapes((btCompoundShape*)(cs->getChildShape(i)), indent+2, i);
+            }
+
         }
     }
 
@@ -707,9 +734,9 @@
         orxout() << endl;
     }
 
-    void Pawn::printSpaces(int number)
+    void Pawn::printSpaces(int num)
     {
-        for(int i=0; i<number; i++)
+        for(int i=0; i<num; i++)
             orxout() << " ";
     }
 }

Modified: code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h	2014-03-13 14:52:23 UTC (rev 10001)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h	2014-03-19 15:07:48 UTC (rev 10002)
@@ -233,6 +233,7 @@
 
             virtual int isMyCollisionShape(const btCollisionShape* cs);
             void printChildShapes(CompoundCollisionShape* cs, int indent, int subshape);
+            void printBtChildShapes(btCompoundShape* cs, int indent, int subshape);
             void printSpaces(int num);
             void printChildShapeMap(std::map<CollisionShape*, btCollisionShape*> map);
 




More information about the Orxonox-commit mailing list