StepPhysics

Description

Steps the physics simulation by a defined amount of time. This time value is in seconds and may include fractions of seconds. Stepping the physics simulation by a large time value (greater than say 0.1) may result in undefined behaviour and physics objects moving through each other. It is not required that you call this command in your game loop, if you do not call it, Sync or Update will call it for you with the last frame time to allow the physics simulation to catch up in real time. If you do call StepPhysics then it will not be called for you by Sync or Update for that frame, this allows you to do your own physics timing if you prefer.

By using a fixed time step every frame your physics will perform exactly the same across all devices and all frame rates, but a reduction in fps will result in the physics appearing to go slower, as it will always step the same amount of time whether the frame was quick or slow to draw. Using a variable step for each frame will keep physics moving at the same speed regardless of frame rate, but it will no longer be deterministic across devices and different frame rates. For example if your game depends on a physics entity falling and bouncing to the same height each time it is run then you should use a fixed time step. If the position of physics objects is not important to your game logic then a variable time step may be best.

Definition

StepPhysics( time )

Parameters