Page 1 of 1

Restitution dependend on timestep

Posted: Fri Sep 01, 2017 10:01 am
by thantalos
Hello guys!

I've been experimenting with bullet and came across a problem I can't explain it and I can't find any information on the problem.
My setup is as simple as possible: a small box and a small ball falling on a fixed large box. Restitution values for all objects are 1.
Image
Everything seems fine when I run the simulation slower than 500Hz (stepSize > 0.002). If I go above 500Hz, the ball suddenly doesn't work correctly any longer. It seems to loose energy, while the box is still behaving correctly.
Image
Sphere z-Position at 400Hz (blue) and 500Hz (red)
Image

Deactivating split impulse adds energy to the system as expected, independent of step size.
Friction parameters have no effect.
Number of iterations has no effect.
Changes to any ERP parameters have no effect.
It seems to be solely dependent on the real step size, using subSteps doesn't change the behavior ("real step size" = fixedStepSize/numSubSteps).

Shouldn't the simulation be more accurate at higher frequencies?

If there is any additional information I can give you please let me know.

Cheers!

Re: Restitution dependend on timestep

Posted: Sat Sep 02, 2017 4:48 pm
by drleviathan
I think someone else noticed this problem a while ago and as I recall: you need enable double precision floats when using very small timesteps.

Re: Restitution dependend on timestep

Posted: Tue Sep 05, 2017 7:36 am
by thantalos
Thank you but I am already using double precision. In any case I can't imagine that the values dealt with here get so small that numerical precision errors cause such a big deviation. And why would that only affect the ball and not also the much more unstable (in theory) box?

Re: Restitution dependend on timestep

Posted: Tue Sep 05, 2017 4:22 pm
by drleviathan
I searched and found the old thread about this problem:

I misremembered the double precision relevance. It was mentioned but it was the same case as here: already being used.

It is a real bug with a reliable repro recipe.

Re: Restitution dependend on timestep

Posted: Sat May 12, 2018 1:11 pm
by kangd
Hello,

I've experienced same issue on Bullet recent version (2.88)

Is there any advanced yet?

Re: Restitution dependend on timestep

Posted: Sat Sep 24, 2022 10:36 am
by bbird5490
I tried this with version 3.25 with the same problem.

You can find my example code in this issue I posted on GitHub:
https://github.com/bulletphysics/bullet3/issues/4341

In my case it works for a btBoxShape but not for the same box implemented as a btConvexHullShape. It also fails for a sphere like in OPs case.

I'm totally not an expert, but the fact that it works for btBoxShape and not for btConvexHullShape makes me think that this should be "solvable"? I went through the code a bit but I don't find anywhere where restitution is handled differently for btBoxShape and btConvexHullShape. Obviously it is different, but I can't find how. Can somebody point me in the right direction? Maybe it's something I can help with.