Why 3-4 timesteps for resolving interpenetration?

pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Why 3-4 timesteps for resolving interpenetration?

Post by pico »

Hi,

i have an old problem that i need to tackle now.

When running Bullet at a 60hz framestep and, lets say, let fall a body onto a static plane (from a few meters high ) it will sink into the ground and needs around 3-4 timesteps until it is no more sunken in. This is fine for non game applications, for games it makes contacts very sluggish. Is there any obvious workaround for this?

Currently our solution is to use four substeps, but this of course comes at costs i want to avoid.
I think currently to cast rays to the ground and handle such collisions myself to get at least for the main character better collision.

btw:
This is not related to tunneling. This happends at speeds much slower then bodies size/framestep.
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: Why ~50 timesteps for resolving interpenetration?

Post by pico »

After checking the contacts each step i noticed it takes easily 50 steps to resolve two simple bodies from collision.
On each physics step the current collision penetration depth shrinks only by 20%.

Is it intended behavior that the solver is that 'soft' ?
Would it maybe be possible to adjust the softness on a per body base?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Why 3-4 timesteps for resolving interpenetration?

Post by Erwin Coumans »

You can increase the error reduction parameter (ERP) for faster penetration recovery. It will, however, increase the energy/velocity added during collision resolution.

Code: Select all

m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
m_dynamicsWorld->getSolverInfo().m_erp = 0.8f;
It is recommended to use values in range 0.2 to 0.8, don't exceed 1.0.

Hope this helps,
Erwin
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: Why 3-4 timesteps for resolving interpenetration?

Post by pico »

Hi Erwin,

thanks for the reply. The behaviour with bigger ERP is much better.

However, it still takes at least on step to get out of penetration. Even at ERP=1.0. Why that?