[ODE] Damping

Colin Bonstead colin at cyan.com
Wed Jul 28 14:24:20 MST 2004


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 );

-----Original Message-----
From: james at 6msoft.com <james at 6msoft.com>
Sent: Wed, 28 Jul 2004 14:07:13 -0700 (PDT)
To: <ode at q12.org>
Subject: Re: [ODE] Damping

Damping is more for simulating air friction. For instance, if you
send a ball flying at a high velocity and have a linear damping value
on it, then it should slow down over time. Angular damping is the
same idea, something is spinning, with angular damping, over time it
will lose angular velocity. It also helps prevent bodies from gaining
energy and exploding. Mass has nothing todo with it.

-James.




More information about the ODE mailing list