HOWTO fixed vs variable timestep: Difference between revisions
From ODE
Jump to navigationJump to search
imported>Russ Created page with "Here is a simple solution for using ODE in an environment with a variable timestep, like a game with an update function that takes the time elapsed since the last call. I just..." |
(No difference)
|
Latest revision as of 21:31, 6 January 2019
Here is a simple solution for using ODE in an environment with a variable timestep, like a game with an update function that takes the time elapsed since the last call. I just used this method in a game I am working on and it works very well, reducing the jitters significantly.
cache = 0 timestep = .01 update(time_elapsed) { cache += time_elapsed while(cache >= timestep) { ~normal simloop of ode using 'timestep' here ~ cache -= timestep } }