Stepping physics - vehicles/characters and camera jittering

luis

06-06-2007 08:35:50

This post made me think about a problem i have to solve.

Everyone using NxOgre is running it with VSync on at exactly 60Hz ? i'd like to know what solutions are you using.

I'm doing a racing game and seems that vehicle physics (i heard charactes have the same problem) needs a very stable timestep.

In fact I have a jittering-free camera only if i manually step the simulation with a literal constant (1.0/60.0) even if i set the VSync to on and pass the real elapsed time ( 1/timesincelastframe is almost 60.039FPS) is not enough and some times i see a jittering in the camera.

I tried to "clamp" the calls to simulate method to a maximum of 60Hz using a time accumulator --> No jittering but some speedups/speedowns.

I also tried using NX_TIMESTEP_VARIABLE and manually subdivide the elapsed time --> Some random Jittering.

I'm starting to think that the only solution will be to use boost threads with a high presition timer & sleep (by 'high' i mean less than 1ms).

Anyone here has the same problem ? any advice ?

thanks.