[ODE] Gravity Issue

Dave Kerr aidave at telus.net
Sun Sep 28 02:11:12 MST 2003


> No, F=ma.  Note the comment on what this code is doing: "add[ing] the
gravity
> *force* to all bodies".  Instantaneous forces don't depend on stepsize.
> Stepsize comes in later, when the accumulated F is being integrated into
the
> body's acceleration/velocity/position.
>--
>Gary R. Van Sickle
>Brewer.  Patriot.

True, but gravity doesnt behave as a traditional force, because it is always
on.  You cant just add gravity once to an object, you have to keep adding
it.

Gravity must be applied at every step call, otherwise the path of a flying
object wont be the same given different step values.  If gravity is not
constantly applied, then the object will have gravitational "stutter" while
in slow motion: moving down every time the step accumulator reaches some
threshold and gravity is applied.

This problem can be solved if we assume the regular gravity force is
dependent on stepsize=1.0.  Then, a fraction of the gravity can be applied
at every step (gravity*stepsize).  This gives a consistent gravity force
even as the stepsize changes in real time.  I'm not sure if this will jive
with ODE tho, or upset alot of peoples simulations, I'm still new to the
code.

Or maybe I'm trying to use the step function in a manner it wasnt intended
for.

Dave

PS. Another solution I'm thinking of is not using built-in gravity, and
build a custom gravity function that is called every step.




More information about the ODE mailing list