btRigidBody touching another object

TimColes
Posts: 1
Joined: Thu Apr 09, 2009 10:15 am

btRigidBody touching another object

Post by TimColes »

Hi,

I'm feeling a little stupid as I'm sure the answer is glaring me in the face. Maybe I'm looking for the wrong terms.

My simple question is, how do I test if a btRigidBody object is touching any other objects? Is there any type of collision flag which will tell me the object is touching? I assumed that as I had stepped the simulation I could then get the contacts that had occurred in the step?

Thank you very much for your help in advance I really appreciate it. I'm sorry its such a trivial question.

Tim Coles
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btRigidBody touching another object

Post by Erwin Coumans »

There are various ways.

Bullet keeps the contact points for each potential overlapping pair of objects in a btPersistentManifold structure. See Bullet/Demos/CollisionInterfaceDemo how to iterate over those contact manifolds.

Although iterating over manifolds is recommended, If you don't want to iterate over all manifolds, you can keep track of overlapping pairs of a given object using a btGhostObject.
See also http://www.bulletphysics.com/mediawiki- ... d_Triggers

Hope this helps,
Erwin