Skip to content

BlobscapeLesson 13 of 24

Feet on the ground

A walk is made on flat ground. Put the walker on steps or a slope and every foot is wrong by the height of the ground under it. How does a game keep feet on the ground without a walk for every staircase?

Things to try

  1. Try nowTry now: Put the elf on uneven ground and find a foot sunk into itHint: Leave the legs as the walk made them.
  2. Up nextLater: Walk the elf on steps with its feet on different treads, every foot on its own tread
  3. Up nextLater: Find a step down a leg can’t reach, then fix it without changing the step
  4. Up nextLater: Stand the elf on a slope of 15° or more with its soles flat on it

Worst foot: on its ground.

0 of 4 goals done.

Ground what the elf stands on

Ground

Feet inverse kinematics

Move

What you just saw

Two bones, one triangle

cos θ = (a² + d² − b²) ÷ 2ad
a, bthe thigh and the shin: their lengths never changedhow far the hip is from where the ankle has to goθhow far the thigh turns off the line from hip to ankle; the knee goes the side it already bends

The elf walks on the spot and the ground slides back under it, exactly as fast as a planted foot moves, so a foot that is down stays on its patch of ground. On steps and slopes the ground also sinks as it slides, one step's height for every step's depth, like an escalator, so the elf climbs without going anywhere.

Each foot is planned before its leg is bent. Down, it rides back with its tread. Up, it swings to where it lands next and rises early enough to clear the highest ground on the way, so a toe never catches a step's edge. Hip, knee and ankle make a triangle whose sides are known, so the knee has one place to go (two, mirror images, and it keeps the side it bent to). That is two-bone inverse kinematics, the same sum a game engine runs on every leg, every frame.

A leg can only reach as far as it is long. Climbing, the foot behind sinks with its tread, so the hips come down by whatever that foot needs and the front knee bends more. The foot is its own bone, so it is turned last, by the slope under it, measured from the ground's height either side.