So far, I've got away with a map structure, using the string as the key to find the corresponding rigid body pointer. However, now that I am trying to implement collision responses, I need to be able to lookup the string from the given collision obj based on this example code snippet from the wiki
Code: Select all
for (int i=0;i<numManifolds;i++)
{
btPersistentManifold* contactManifold = physicsWorlds[currentWorldID]->getDispatcher()->getManifoldByIndexInternal(i);
btCollisionObject* obA = const_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = const_cast<btCollisionObject*>(contactManifold->getBody1());
Ideally, I should probably override the btRigidBody (similar to what I have done for the motion state setup) to add my string as a member variable on creation, but my C++ experience is still new, so I'm not sure whether this is easily possible if at all), and what problems it might occur both with the current bullet code, and for upgrading to future versions.
Can anyone suggest the best way to achieve what I need?
Thanks.