01 · Movement · 2D and 3D

Acceleration and friction

Speed that builds up and bleeds off, instead of on/off movement.

If the character jumps straight to full speed and stops dead, movement feels like a cursor, not a body. Giving speed a short ramp up and a short ramp down adds weight. The two numbers decide whether your game feels snappy like Celeste or slippery like an ice level.

←→ run123 snappy / default / iceHold ◀ ▶ to run

Try this: Run right, then flip to left. Try it on Snappy, then on Ice, and watch the speed graph.

speed over the last 2 secondstarget speed

Hold a direction, then let go.

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.

Add acceleration and friction to movement: each frame move velocity toward input times maxSpeed by a fixed rate times delta time, reaching full speed in about 0.1 s, and use the faster stopping rate when input points against velocity so turning never drags.

43 words · one sentence to paste as is

Where it's used

Common mistakes

Using physics engine drag for friction (it never truly stops and changes with mass), forgetting delta time so feel changes with frame rate, and letting the move-towards step overshoot so the character jitters around zero speed.

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.