Hi
I'd like to use bullet not for collision response but only for collision detection, but with moving bodies. How do I do that? In particular, it would be nice if I could receive callbacks only for "begin collision" and "end collision" not each time a body pair overlaps.
Using bullet for overlapping bodies, begin/end_collision
-
- Posts: 9
- Joined: Tue Feb 03, 2009 6:36 pm
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Using bullet for overlapping bodies, begin/end_collision
It is not clear what you mean by 'begin collision' and 'end collision'.
Bullet can report when contact points are added, updated and removed. For all of those there are contact callbacks:
ContactAddedCallback gContactAddedCallback;
ContactDestroyedCallback gContactDestroyedCallback;
ContactProcessedCallback gContactProcessedCallback;
Just assign the callback, and flag objects that require a callback:
See attached BasicDemo for example usage.
In general, it is better to iterate over the overlapping pairs, and just check the number of contacts the the contact manifold. See Bullet/Demos/CollisionInterfaceDemo.
Hope this helps,
Erwin
Bullet can report when contact points are added, updated and removed. For all of those there are contact callbacks:
ContactAddedCallback gContactAddedCallback;
ContactDestroyedCallback gContactDestroyedCallback;
ContactProcessedCallback gContactProcessedCallback;
Just assign the callback, and flag objects that require a callback:
Code: Select all
body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
In general, it is better to iterate over the overlapping pairs, and just check the number of contacts the the contact manifold. See Bullet/Demos/CollisionInterfaceDemo.
Hope this helps,
Erwin
You do not have the required permissions to view the files attached to this post.