PDA

View Full Version : Timesetp and State?


Sean Doherty
12-03-2005, 06:01 PM
In the following article:

http://www.gaffer.org/articles/Timestep.html

I kind understand where state kets calculated? If you look at the first example they call:

integrate(state, t, dt);

but state was never calculated?

Thanks

ggambett
12-03-2005, 06:16 PM
Think of state as a struct passed by reference. integrate() is what updates the state, based on its old values, t, and dt.

Sean Doherty
12-03-2005, 06:32 PM
Think of state as a struct passed by reference. integrate() is what updates the state, based on its old values, t, and dt.

I looking at the sample code and I have everything working except the final step where I pass state to render. Do I need the integrate function?

I ws trying to do it with? by calculating the following for rendering:

g_dTimeStepRemainder = dAccumulator / kDeltaTime

Does not seem to work, it is very jerky.

FlySim
12-03-2005, 06:38 PM
I am a bit confused by his solution. He updates the
physics at 100Hz and if the render refresh rate is 75Hz, it looks
like he will bounce between 1 and 2 physics update each frame - seems
like this could be jerky. Or more likely Im missing something....

EDIT:
I read a little further - you need to interpolate to get it smooth - makes more sense now....