Page 1 of 1

Dynamically skipping collision response.

Posted: Mon Nov 26, 2018 4:11 am
by bram
I am using gContactProcessedCallback so that I can control the collision response, on the fly.
This works well so far (I use it to implement a more complex friction behaviour.)

However, in some cases, I want dynamically have the option to decide to have no contact response.

What I tried was have my gContactProcessedCallback return false instead of true.
But its return value is not used in btCollisionDispatcher.cpp, I determined.

I also tried setting cp.m_appliedImpulse to zero, but that wont stop the response either.

Is there a way negate the collision response?
Because I don't know in advance whether the response is req'd or not, I can't use my current filter mechanism of setting group/mask of the bodies.
For a certain group pair, I want sometimes a response, but sometimes no response, based on complex run-time criteria.

thx

Re: Dynamically skipping collision response.

Posted: Mon Nov 26, 2018 4:56 am
by Erwin Coumans
One thing you can try it setting the cp.m_distance1 to a very large value (for exampe BT_LARGE_FLOAT), so it will be skipped by the solver.

The cp.m_appliedImpulse is a return value from the solver, also used in case of warmstarting, so I wouldn't modify that value.

Re: Dynamically skipping collision response.

Posted: Mon Nov 26, 2018 5:17 am
by bram
Excellent, this works just fine. Thanks for the suggestion.