[ODE] Damping

Jon Watte hplus-ode at mindcontrol.org
Fri Jul 30 09:48:29 MST 2004


> the equation is something like...

> a = damping * timeStep
> a = clamp(a, 0, 1)
> vel *= 1 - a

This looks wrong. If I step five times with time step 0.2 
using this method, I will get a different end velocity than 
if I step twenty times with time step 0.05. I believe you 
need to involve a powf() in the calculation of the actual 
timestep dependent damping to apply, if you apply it to 
velocity in this way. Alas, powf() is sadly quite slow :-(

If you don't want to involve the powf(), I'd suggest not 
scaling damping by timestep at all, and save both a multiply 
per body and the clamp (which may possibly branch, which may 
be more expensive than a divide).

> For disabling, right now setting the damping of a body to 0 disables it,
> but currently no way across a world (but it can obviously be done.

May I suggest that you make the damping API mirror the 
auto-disabling API as closely as possible, for consistency?

Cheers,

			/ h+




More information about the ODE mailing list