# [ODE] Newbie Question on Numerical Integration Method

Jon Watte (ODE) hplus-ode at mindcontrol.org
Mon Jun 6 10:10:54 MST 2005

```The ODE solver uses a first-order forward integrator; it cannot switch
methods (as doing the LCP solver to a higher order would be
significantly harder...)

If you have "wiggle" on resting bodies, the first thing to look at is
your time step. You should be using a fixed time step, and step enough
times to catch up to real time, but no more. The reason for this is that
bodies "resting" in ODE really are continually falling into the ground,
and getting a penalty force applied that pushes them out. If the time
step varies, they fall different lengths each timestep, and get
different forces applied, which ends up causing instability.

There's a discussion about fixed time step implementation at
http://www.mindcontrol.org/~hplus/graphics/game_loop.html

Another thing most people do is add dampening for both regular inertia
and rotational inertia. Each time step, get the velocity and angular
velocity for each object, and add a small "drag" force/torque counter to
the current movement; typically on the order of one percent of the
current velocity.

The last thing to do is to realize that ODE is a system designed to give
you believable simulations for computer games, not engineering-quality
simulations of arbitrarily complex scenes. If that's your goal, you want
to use more complex, often offline methods.

Cheers,

/ h+

James wrote:
> Hi,
> Some strange things are happening with my simulation and an engineering
> friend of mine suggested that it may be because my simulator is using
> Euler's method for stepwise numerical integration. He suggested I look
> into switching to another method, such as Runge-Kutta.
> I'm not an engineer and, alas, I don't precisely know what he's
> suggesting. I am wondering though, which method does ODE use by default?
> Is there a way to switch methods? Can this be the cause of weird
> behaviour such as accelerated 'wiggle' of bodies that should to be static?