Why does getBody0() and getBody1() return a void* as opposed to a btRigidBody?
I don't know the reason for sure. If you check the Header file of btPersistentManifold:
These two pointers are initialized as void pointer, so in the getBody0() and getBody1(), they should return a void pointer. void* will allow any collision class, including GhostObject, SoftObject and RigidObject. But definitely you can point these two to btRigidBody. Just use the commented line in your pasted code:
Code: Select all
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
Why does the wiki say this is the best way to do collisions?
I suppose there are two reasons. First is that it is fast, you don't need to do the collision detection by yourself. Second is that it is accurate, you won't miss a collision when iterating through all the collision pairs.
Can there be more than 1 manifold per collision pair?
Definitely, there can be more than 1 manifold inside per collision pair. and that's this loop for:
Code: Select all
for (int i=0;i<numManifolds;i++)
{
.........
}