12 · Physics & collisions · 2D and 3D

Fixed timestep

Run physics in equal slices, whatever the frame rate.

Physics with a variable step gives different results on different machines: jump heights change, fast objects tunnel, and replays desync. Running physics in fixed slices (say 1/60 s) using an accumulator, and drawing an interpolated position between slices, keeps simulation identical and motion smooth.

Space jump both123 20 / 60 / 144 fpsTap the scene to jump

Try this: Pick 20 fps and jump: the variable-step ball jumps to a different height each time. The fixed-step ball always peaks at the line.

variable stepfixed 1/60 s step

Variable peak -Fixed peak -

Jump at different frame rates.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Run physics on a fixed timestep: accumulate frame delta time, step the simulation in slices of 1/60 s while the accumulator allows, render by interpolating between the last two physics states, and cap catch-up at 5 steps per frame so a slow frame cannot spiral.

45 words · one sentence to paste as is

Where it's used

Common mistakes

Moving physics objects in the render update (stutter and tunneling), no interpolation so motion judders at high refresh rates, uncapped catch-up steps that freeze the game after a hitch, and losing button presses that happen between fixed steps.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.