How to check if convex bodies are colliding with each other?

SteveDeFacto
Posts: 31
Joined: Sat Jul 23, 2011 4:24 pm

How to check if convex bodies are colliding with each other?

Post by SteveDeFacto »

I placed some rigid bodies in my world and I need to test if they are colliding with each other before calling stepSimulation. How do I do this?
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: How to check if convex bodies are colliding with each ot

Post by dphil »

To test for collision with specific objects...

To test collision between a specific pair of objects:

Code: Select all

void 	btCollisionWorld::contactPairTest (btCollisionObject *colObjA, btCollisionObject *colObjB, ContactResultCallback &resultCallback)
To test for for collision between one specific object and all other objects:

Code: Select all

void 	btCollisionWorld::contactTest (btCollisionObject *colObj, ContactResultCallback &resultCallback)
http://bulletphysics.com/Bullet/BulletF ... 7b36a640c8
http://bulletphysics.com/Bullet/BulletF ... 18f8480999

I'm not certain how to do a generic collision detection between all pairs of objects between simulation steps. Perhaps btCollisionWorld::performDiscreteCollisionDetection(), but I am not familiar with it.