[Orxonox-commit 5340] r10003 - in code/branches/modularships: data/levels src/orxonox/collisionshapes src/orxonox/worldentities src/orxonox/worldentities/pawns
noep at orxonox.net
noep at orxonox.net
Thu Mar 20 15:46:06 CET 2014
Author: noep
Date: 2014-03-20 15:46:06 +0100 (Thu, 20 Mar 2014)
New Revision: 10003
Modified:
code/branches/modularships/data/levels/emptyLevel.oxw
code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.cc
code/branches/modularships/src/orxonox/worldentities/WorldEntity.cc
code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
Log:
A Pawn being hit now prints it's Collisionshape-Structure, as well as the WorldEntity every on of those CollisionShapes belongs to.
Modified: code/branches/modularships/data/levels/emptyLevel.oxw
===================================================================
--- code/branches/modularships/data/levels/emptyLevel.oxw 2014-03-19 15:07:48 UTC (rev 10002)
+++ code/branches/modularships/data/levels/emptyLevel.oxw 2014-03-20 14:46:06 UTC (rev 10003)
@@ -62,6 +62,16 @@
<BoxCollisionShape position="0,0,60" halfExtents="30,30,30" />
</collisionShapes>
</StaticEntity>
+ <StaticEntity position="0,-180,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+ <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
</attached>
<collisionShapes>
<BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
Modified: code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.cc 2014-03-19 15:07:48 UTC (rev 10002)
+++ code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.cc 2014-03-20 14:46:06 UTC (rev 10003)
@@ -39,6 +39,8 @@
#include "core/XMLPort.h"
#include "tools/BulletConversions.h"
+#include "collisionshapes/WorldEntityCollisionShape.h"
+
namespace orxonox
{
RegisterClass(CompoundCollisionShape);
@@ -117,6 +119,11 @@
this->updatePublicShape();
}
+
+ // If the shape to be attached is not a CompoundCollisionShape (thus an actual physical shape) & this is a WorldEntity's CollisionShape,
+ // set it's userPointer to the WorldEntity this CompoundCollisionShape belongs to.
+ if (!orxonox_cast<CompoundCollisionShape*>(shape) && orxonox_cast<WorldEntityCollisionShape*>(this))
+ shape->getCollisionShape()->setUserPointer(orxonox_cast<WorldEntityCollisionShape*>(this)->getWorldEntityOwner());
}
/**
Modified: code/branches/modularships/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/WorldEntity.cc 2014-03-19 15:07:48 UTC (rev 10002)
+++ code/branches/modularships/src/orxonox/worldentities/WorldEntity.cc 2014-03-20 14:46:06 UTC (rev 10003)
@@ -45,6 +45,7 @@
#include "core/XMLPort.h"
#include "Scene.h"
#include "collisionshapes/WorldEntityCollisionShape.h"
+#include <BulletCollision/CollisionShapes/btCollisionShape.h>
namespace orxonox
{
Modified: code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc 2014-03-19 15:07:48 UTC (rev 10002)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.cc 2014-03-20 14:46:06 UTC (rev 10003)
@@ -629,15 +629,19 @@
orxout() << this->getRadarName() << ": Searching for btCS* " << cs << endl;
// e.g. "Box 4 is WorldEntityCollisionShape 0x126dd060"
orxout() << " " << this->getRadarName() << " is WorldEntityCollisionShape* " << ownWECS << endl;
- // e.g. "Box 4 is btCollisionShape 0x126dd060"
- orxout() << " " << this->getRadarName() << " is btCollisionShape* " << ownWECS->getCollisionShape() << endl;
+ // e.g. "Box 4 is WorldEntity 0x126dd060"
+ orxout() << " " << this->getRadarName() << " is WorldEntity* " << this << endl;
// e.g. "Box 4 is objectID 943"
orxout() << " " << this->getRadarName() << " is objectID " << this->getObjectID() << endl;
+ // List all attached Objects
+ orxout() << " " << this->getRadarName() << " has the following Objects attached:" << endl;
+ for (int i=0; i<10; i++)
+ orxout() << " " << i << ": " << this->getAttachedObject(i) << endl;
+
// print child shapes of this WECS
// printChildShapes(ownWECS, 2, 0);
printBtChildShapes((btCompoundShape*)(ownWECS->getCollisionShape()), 2, 0);
- // printChildShapeMap(ownWECS->getShapesMap());
// end
@@ -714,26 +718,23 @@
{
printSpaces(indent+2); orxout() << "- " << i << " - - -" << endl;
- // For each childshape, print:
+ // For each childshape, print: (as long as it's not another CompoundCollisionShape)
+ if (!orxonox_cast<btCompoundShape*>(cs->getChildShape(i)))
+ {
+ // pointer to the btCollisionShape
+ printSpaces(indent+2); orxout() << "btCollisionShape*: " << cs->getChildShape(i) << endl;
- // pointer to the btCollisionShape
- printSpaces(indent+2); orxout() << "btCollisionShape*: " << cs->getChildShape(i) << endl;
+ // pointer to the btCollisionShape
+ printSpaces(indent+2); orxout() << "m_userPointer*: " << cs->getChildShape(i)->getUserPointer() << 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);
- }
}
}
- void Pawn::printChildShapeMap(std::map<CollisionShape*, btCollisionShape*> map)
- {
- orxout() << endl;
- }
-
void Pawn::printSpaces(int num)
{
for(int i=0; i<num; i++)
Modified: code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h 2014-03-19 15:07:48 UTC (rev 10002)
+++ code/branches/modularships/src/orxonox/worldentities/pawns/Pawn.h 2014-03-20 14:46:06 UTC (rev 10003)
@@ -235,7 +235,6 @@
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);
private:
void registerVariables();
More information about the Orxonox-commit
mailing list