07 · Movement · 2D and 3D

Slopes and step offset

Walk up ramps and small steps without bouncing or sticking.

Box-shaped characters treat a ramp like a wall or launch off the top of it, and a 2 px ledge stops them dead. Good movement moves along the slope surface, sticks to the ground going downhill, refuses slopes that are too steep, and steps up small ledges automatically.

←→ moveG slope handling on/offHold ◀ ▶ to walk

Try this: Walk right over the ramp and the small step with handling off: you bounce down the slope and stop at the step. Turn it on with G.

Airborne frames going downhill 0

Walk over the ramp and the step.

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.

Handle slopes and steps: move along the ground surface instead of straight sideways, snap down within 0.2 units while walking downhill, treat slopes over 45 degrees as walls, step up ledges under 0.3 units, and skip snapping for 0.1 s after a jump.

43 words · one sentence to paste as is

Where it's used

Common mistakes

Moving horizontally into slopes so speed changes uphill and downhill, no ground snap so characters bounce down ramps and launch off crests, snapping during jumps so jumps get cancelled, and step offsets so big that characters climb walls.

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.