I am currently working on a project where I need to compute the minimal distance between objects. If the objects are penetrating each other, I need their penetration depth. Bullet seems to be a good library for this task, but I just started diving in and have some starting problems. It would be nice, if someone could help me.
I looked into the CollisionInterfaceDemo and found a code snipped, which should push me into the right direction:
Code: Select all
//another way is to directly query the dispatcher for both objects. The objects don't need to be inserted into the world
btCollisionAlgorithm* algo = collisionWorld->getDispatcher()->findAlgorithm(&objects[0],&objects[1]);
btManifoldResult contactPointResult(&objects[0],&objects[1]);
algo->processCollision(&objects[0],&objects[1],collisionWorld->getDispatchInfo(),&contactPointResult);
btManifoldArray manifoldArray;
algo->getAllContactManifolds(manifoldArray);
As far as I understand, this code finds me the right algorithm for my kind of objects (mostly convex objects) and computes the contact manifold. My Problem is that it seems, that the bullet interface changed over time. The findAlgorithm method takes now two btCollisionObjectWrapper objects instead of btCollisionObject objects. How can I get the wrapper of an collision object? Do I have to create it on my own?
Regardless of this problem, I am not quite sure if I am doing the right thing. Are the contact points of the contact manifold containing the penetration depth if objects are penetrating each other and otherwise containing the minimal distance? Or do I have to use multiple algorithms?
Thanks in advance!
Tobias