22 · Camera · 2D and 3D

Camera smoothing

A follow camera that glides instead of snapping.

A camera glued to the player jitters with every step and makes fast games tiring to watch. Letting it catch up smoothly feels calmer. The catch: the common shortcut, moving 10% of the way each frame, is faster on high refresh screens. The fix is one line that uses delta time.

←→ moveM camera modeF frame rateHold ◀ ▶ to run

Try this: Run on Naive lerp at 30 fps, then at 144 fps: the camera lags by a different amount. Switch to Damped and it stays the same.

camera centreplayer

Camera lag 0 px

Run left and right.

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.

Smooth the follow camera with frame-rate independent damping: position = lerp(position, target, 1 - exp(-deltaTime / 0.12)), so it settles in about 0.3 s at any frame rate, and snap instantly on respawns or teleports instead of sliding across the level.

41 words · one sentence to paste as is

Where it's used

Common mistakes

A fixed lerp factor (different on every refresh rate), updating the camera before the player moves (one-frame jitter), following the raw physics position instead of the interpolated one, and smoothing across teleports so the camera flies across the map.

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.