This project is read-only.

Collision Event

Topics: Developer Forum, User Forum
May 12, 2007 at 10:13 PM

I am using the managed Bullet library and would like to know if there is a way to be notified when two RigidBodies collide. If not, could this feature be added or how would I add it myself?

May 15, 2007 at 3:57 AM
Edited May 15, 2007 at 4:41 AM
Not sure about Bullet managed version, but in general there are several ways to check if bodies collide:

1) Write your own 'ContactAddedCallback', and set CollisionFlags.CustomMaterialCallback for each body that need notification. See ManifoldResult.cs how to set this callback.
2) Visit all contact points, and check if the two rigid bodies are involved. Check GetManifoldByIndex(..) in CollisionDispatcher.cs
3) Registration of a nearCallback, using dispatcher->setNearCallback(). This means you have to copy/paste the default implementation of the existing DefaultNearCallback and add your check (check CollisionDispatcher.cs)

A more user-friendly callback mechanism can be added in the future.

Otherwise feel free to post the question on the regular (non-managed) Bullet Physics forum at
Hope this helps,
Jun 16, 2007 at 12:32 PM
we have successfully integrated BulletX in our game, and I can say it's working superb. Just like 'terminator', we need a mechanism to be notified when a collision on objects had been produced, to play a sound accordingly.

Are you including an delegate/event mechanism in the CollisionObject in the near future?

I have tried to do it myself, but I just can't get it to work, can you give me at least some more advice on this subject?

Jun 25, 2007 at 5:46 AM

Nolver, have you tried all the 3 suggested methods (contact callback, traverse all contact points, nearcallback) ?

If so, can you give more details what went wrong/where you got stuck with each method? Preferably reply on forum