Space.Update(float) in 0.16.0

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
duke
Posts: 7
Joined: Sat Jul 02, 2011 11:06 am

Space.Update(float) in 0.16.0

Post by duke »

Hi,

I upgraded from v0.15 to v0.16 for Windows Phone and now my physics world seems to update more slowly. I have set space.TimeStepSettings.TimeStepDuration = 1 / 60f; When I call

space.Update((float)gameTime.ElapsedGameTime.TotalSeconds);

i think only one timestep is occurring instead of as many as required for the specified time interval which should be 2 in my case. Is it a bug? Can I just call Update() twice to compensate with no side-effects or performance problem?

Thanks
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Space.Update(float) in 0.16.0

Post by Norbo »

The only thing that I recall changing about internal time stepping is that the default maximum time steps per frame was lowered to 3, but that's plenty for 1/60f with a game update of 1/30f seconds. If the game is actually running at a 1/15 second update, then the engine will need to do 4 steps to keep up. If that's what is causing it, then setting the Space.TimeStepSettings.TimeStepCountPerFrameMaximum to 4 or more will fix the issue.

You could call Update() directly too; it would end up doing the exact same thing if the game has IsFixedTimeStep set to true. If it doesn't have a fixed time step, then calling Update() a fixed number of times per frame would cause the simulation to speed up and slow down as the game update rate changed. That's what internal time stepping is designed to address.
duke
Posts: 7
Joined: Sat Jul 02, 2011 11:06 am

Re: Space.Update(float) in 0.16.0

Post by duke »

Increasing TimeStepCountPerFrameMaximum to 4 did the trick.

I just realised I am passing ElapsedGameTime.TotalSeconds * 2 into space.Update() so that explains why I need to increase the TimeStepCountPerFrameMaximum. Thanks!
Post Reply