[ODE] continuous forces w/ constant step size

Tyler Streeter tylerstreeter at yahoo.com
Fri Sep 17 10:22:43 MST 2004


I don't see how that would do anything different from
the pseudocode I posted.  In your pseudocode, the
input and continuous forces are still being applied
only once per visual frame, not once per time step. 
Input will then be applied more often on a fast
machine than on a slow machine.

Tyler

--- John Miles <jmiles at pop.net> wrote:

> >
> > Here's the problem with it: The
> continuously-applied
> > forces and the input only get updated once per
> frame,
> > not once per time step, which yields different
> results
> > depending on the frame rate.  These things need to
> get
> > applied per time step to get consistent results.
> 
> Actually, they don't.  What you're missing is that
> ODE's idea of the passage
> of time is different than your game's.  Try
> something like this:
> 
> wall_clock = 0  // or whatever time your simulation
> begins at...
> physics_clock = wall_clock   // if saving states,
> you need to restore this
> instead!
> 
> while (1)
> 	wall_clock += frame_dT  // actual amount of time
> taken by last frame
> 	// get input, apply forces, etc.
> 
> 	while (physics_clock < wall_clock)
> 		physics_clock += fixed_timestep_msec
> 
> 		// generate collisions
> 		// step the world (fixed_timestep_msec)
> 	end
> 
> 	// render, etc.
> end
> 
> This will quantize the ODE timebase without keeping
> it locked to your game's
> frame rate.
> 
> -- jm
> 
> 



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


More information about the ODE mailing list