Page 1 of 1
Bouncing Ball
Posted: Tue Sep 13, 2005 2:27 am
by fork
How do you guys get a bouncing ball to eventually come to rest? It would be nice if somehow the velocity and position became zero eventually due to floating point round-off errors.
Posted: Tue Sep 13, 2005 7:00 am
by Erwin Coumans
Most physics engines have several parameters so the velocity of a bouncing ball becomes zero after a while.
- Restitution coefficient: less then 100% restitution will bring back the linear velocity after every collision.
- velocity damping will generally reduce velocity every timestep
Posted: Sat Sep 17, 2005 5:52 pm
by fork
Could you be more concrete on how that will stop all jittering?
Posted: Thu Oct 19, 2006 2:44 am
by jebus
How much jittering are we talking about?
With any physics simulations, objects resting on other objects are generally always jittering to some degree which is also true in reality.
If you want to be able to make sure that an object remains absolutely still, then you could put in a check:
Code: Select all
if (vel.length() < minVel)
vel = 0;
This way the ball's velocity will be considered zero when it is very small.
Posted: Thu Oct 19, 2006 3:37 am
by SteveBaker
Even if you didn't clamp it, the fact that the computer doesn't have infinite precision should mean that roundoff error will eventually allow the velocity to reach zero.
But since that could take quite a while and there are performance optimisations to be had by stopping things from moving unnecessarily, it's probably a good idea to clamp it anyway.