It may be obvious but I really can't see it... How can I get if a rigid body is currently colliding with another and get the contact point world position and its normal.
In other words pretty much what a btCollisionWorld::ClosestRayResultCallback does but that I can get directly from an arbitrary rigid body.
Tks in advance,
Cheers,
Get the contact point of a rigid body.
-
- Posts: 31
- Joined: Tue Jul 29, 2008 10:26 am
-
- Posts: 229
- Joined: Sun Sep 30, 2007 7:58 am
Re: Get the contact point of a rigid body.
Hi,
check out the callback section in the Wiki.
check out the callback section in the Wiki.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Get the contact point of a rigid body.
A contact point doesn't belong to a single rigid body. You always need a pair of rigid bodies for contact. Contacts (points) are stored in persistent manifold structures, owned by a collision algorithm/overlapping pair.
Here are a few methods to get access to contact points, sorted from easy to harder to implement:
Erwin
Here are a few methods to get access to contact points, sorted from easy to harder to implement:
- Implement a contact added/process/removed callback
- Iterate over all contact manifolds, and take the one you need, see Bullet/Demos/CollisionInterfaceDemo
- If you have two rigid bodies, you can lookup if an overlapping pair exists, and iterate over their contact manifold(s).
- Use the btPairCachingGhostObject to keep track of all overlapping bodies and pairs for a particular body. Then just iterate over the contact manifolds.
Erwin