Restitution dependend on timestep

Post Reply
thantalos
Posts: 2
Joined: Fri Sep 01, 2017 9:33 am

Restitution dependend on timestep

Post 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!
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Restitution dependend on timestep

Post 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.
thantalos
Posts: 2
Joined: Fri Sep 01, 2017 9:33 am

Re: Restitution dependend on timestep

Post 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?
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Restitution dependend on timestep

Post 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.
kangd
Posts: 9
Joined: Tue Oct 24, 2017 11:51 am

Re: Restitution dependend on timestep

Post by kangd »

Hello,

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

Is there any advanced yet?
bbird5490
Posts: 1
Joined: Sun Jun 05, 2022 11:24 am

Re: Restitution dependend on timestep

Post 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.
Post Reply