Page 1 of 1

slow motion

Posted: Mon Nov 14, 2011 4:39 pm
by quaikohc
hi

i have two questions:
1. is it possible and how to correctly implement a slow motion simulation ?
2. the same about frame by frame simulation - simulating scene one frame forward after hitting a key for example

TIA

Re: slow motion

Posted: Mon Nov 14, 2011 7:16 pm
by snoozbuster
quaikohc wrote: 2. the same about frame by frame simulation - simulating scene one frame forward after hitting a key for example
I'd imagine just calling Space.Update() once when that key is pressed would work just fine.

As for the first, if I had to try something I'd try lowering the value passed into Space.Update().

Re: slow motion

Posted: Mon Nov 14, 2011 8:53 pm
by Norbo
1. is it possible and how to correctly implement a slow motion simulation?
if I had to try something I'd try lowering the value passed into Space.Update().
That's one way to do it, though it relies on internal time stepping and using the interpolation buffers for smooth motion. Each individual timestep (A Space.Update(dt) call can have 0 to many timesteps in it, depending on dt) will still cover whatever is in the Space.TimeStepSettings.TimeStepDuration.

Changing the Space.TimeStepSettings.TimeStepDuration is the other main way. It defaults to 1/60f. If you change it to 1/120f, time will progress at 1/2 the normal rate assuming you do the same number of time steps. If you're using internal time stepping (calling Space.Update(dt) rather than Space.Update()), watch out- it will try to simulate the passed in time using more time steps.

Also note that changing the time step duration constantly can harm simulation stability. Occasionally changing it to slow mo and back shouldn't cause a big problem, but keep it in mind.
2. the same about frame by frame simulation - simulating scene one frame forward after hitting a key for example
I'd imagine just calling Space.Update() once when that key is pressed would work just fine.
Yup. The parameterless Space.Update() performs one time step.