Dynamically skipping collision response.

Post Reply
bram
Posts: 50
Joined: Sun Nov 23, 2008 4:43 pm

Dynamically skipping collision response.

Post by bram » Mon Nov 26, 2018 4:11 am

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

User avatar
Erwin Coumans
Site Admin
Posts: 4193
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Dynamically skipping collision response.

Post by Erwin Coumans » Mon Nov 26, 2018 4:56 am

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.

bram
Posts: 50
Joined: Sun Nov 23, 2008 4:43 pm

Re: Dynamically skipping collision response.

Post by bram » Mon Nov 26, 2018 5:17 am

Excellent, this works just fine. Thanks for the suggestion.

Post Reply