[ODE] Damping

gl gl at ntlworld.com
Thu Jul 29 07:41:38 MST 2004


Would be useful to have this in the core...
--
gl

----- Original Message ----- 
From: "Colin Bonstead" <colin at cyan.com>
To: <ode at q12.org>
Sent: Wednesday, July 28, 2004 10:24 PM
Subject: Re: [ODE] Damping


> Here's something Jon posted a little while back.  If you do a Google 
> search with site:q12.org you can find answers to common questions like 
> this.
> 
> 1) Add damping. For each object, for each step, add counter-
>    force scaled by linear velocity, and counter-torque scaled 
>    by angular velocity. From memory, it looks something like:
> 
>    /*  Apply damping to the body to get it to settle properly     */
>    /*  over time. This also simulates "air drag" or "rolling      */
>    /*  friction" to some extent.                                  */
>    /*  Change "-0.01f" to some other negative number for tuning.  */
>    dVector3 v;
>    dBodyGetLinearVelocity( body, v );
>    v[0] *= -0.01f;   v[1] *= -0.01f;   v[2] *= -0.01f;
>    dBodyAddForcce( body, v );
>    dBodyGetAngularVelocity( body, v );
>    v[0] *= -0.01f;   v[1] *= -0.01f;   v[2] *= -0.01f;
>    dBodyAddTorque( body, v );



More information about the ODE mailing list