slow motion

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
quaikohc
Posts: 2
Joined: Mon Nov 14, 2011 4:36 pm

slow motion

Post 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
snoozbuster
Posts: 172
Joined: Sat Sep 24, 2011 7:31 am

Re: slow motion

Post 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().
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: slow motion

Post 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.
Post Reply