Im trying to sort out when one of my btGImpactMeshShapes collides with something and process it accordingly. I can do this quite fine right now using:
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
if(obA->getCollisionShape()->getName() == m_GImpactShape->getName() || obB->getCollisionShape()->getName() == m_GImpactShape->getName())
Problem is that this will only work for one btGImpactMeshShape since getName() returns ""GImpactMesh"" and nothing else, hard coded into btGImpactShape.h. I need to know which one of my btGImpactMeshShapes that is colliding in order to process that individual mesh properly. Ive overloaded btGImpactMeshShape just adding set/get debug_ID to enable tagging the shapes, but I still need to set the ID to something. My thought being ofc to set it to the same ID that bullet uses for its rigidbody. I CAN get this ID by doing:
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
btRigidBody* testA = (btRigidBody*)obA; //get the debugID of the rigidBody of the collision object.
btRigidBody* testB = (btRigidBody*)obA; //get the debugID of the rigidBody of the collision object.
testA->m_debugBodyId;
testB->m_debugBodyId;
However, in order to do that I need my btGImpactMeshShape to be a btCollisionObject being used by the btPersistentManifold, aka colliding with something. Im sure theres some way to access the rigidBody of the btGImpactshape in some other way, but I just cant seem to find how. What I would like to do is to access the rigidBody as soon as I creates my btGImpactMeshShape and set its debugBodyId accordingly. Any hints on how to do this? feeling kinda lost here atm
