Collision response

rziqi
Posts: 1
Joined: Fri Oct 31, 2008 6:47 pm

Collision response

Post by rziqi »

Hi,
I have implemented a simple collisions callback by iterating on manifolds after the simulation step, but some objects can decide to not collide with the second object when they receive the callback, this depends on the information contained in the contact points. what I did is I remove the overlaping pair from the broad phase:
BroadPhase->getOverlappingPairCache()->removeOverlappingPair(obj1->getBroadphaseHandle(),obj2->getBroadphaseHandle(),Dispatcher);
I want to know if it is safe to do this or there is a better mecanism to cancel a collision after the narrow phase when the contacts points have been calculated,
Thanks
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Collision response

Post by Erwin Coumans »

It is not safe to add or remove overlapping pairs, only the broadphase should perform those actions internally (we should probably make those methods protected).

There is not an easy way to do this. One option is to replace the collision algorithm by a btEmptyCollisionAlgorithm. Other options are to clear the contact manifold. We'll look into it, but perhaps we need to add some flags to allow ignoring existing contacts/pairs.

Thanks for the feedback,
Erwin