IT lexicon › Programming › Slope collision

Slope collision

Programming På svenska → Updated: 2026-10-26

Handling movement along angled ground in platformers — keeping the character grounded on a hill, projecting velocity along the surface, and limiting how steep a climb is allowed.

Plain tile collision with square cells handles slopes poorly: the character snaps off the hill every step, or catches on the staircase of blocks under a diagonal. Slope handling instead reads a per-tile angle, or the surface normal, and resolves movement along the slope's tangent so the character follows the ground smoothly up and down.

Around that sit thresholds and special cases. A slope steeper than some angle should not be walkable — the character slides down instead. A small step offset lets it climb low ledges without snagging. And ground snapping keeps it stuck to the hill on descents, or it hops into the air at every little kink in the terrain.

← Back to the lexicon