Motion · Act I

Imagine a creature whose legs automatically adapt to the terrain underneath. No manual drawing of walk/run cycles. This is possible and well known! A foot stays planted until the body leaves it behind, then steps to a new hold.
Give my creature procedural legs: feet that plant and step, two-bone inverse kinematics, no walk cycle.
Read the whole briefFold the brief
Give [my crab] procedural legs. No walk cycle: code places the legs every frame. - The body moves on its own and knows nothing of legs. - Each leg: a hip fixed to the body, a foot, and two bones between them of [7] and [10] px. - Find the knee with the law of cosines (two-bone inverse kinematics). Front knees bend forward, back knees backward. - A foot stays planted until it is more than [7] px from its home, a point that travels with the body. Then it steps. - A step takes [0.24] s, lifts the foot [5] px, and lands on the ground a little ahead of home. - Legs step in diagonal pairs, in turn. Never lift two neighbors at once. - The body rides at the mean height of its feet, a moment late. - Draw the legs in whole pixels, in my sprite's outline color. The body stays a sprite.
Change what stands in [brackets] to fit your game.
- When the terrain is complex, or can change. A good example is the stickman animation in Destroy Any Website.
- Spiders, robots, and things that have many legs. Perfect use-case.
Not forPlatformers where the terrain is predictable, or when your character's legs can't be easily modeled as stick shapes.
Rain World's creatures have their limbs placed by code each frame.[1] The rule of the step is set out in WeaverDev's tutorial,[2] and the two-bone leg in Alan Zucconi's series.[3] The crab and its gait are this atlas's own.
- Exploring procedural design in Rain World, Unity blog
- WeaverDev, Procedural animation tutorial
- Alan Zucconi, Inverse kinematics in 2D, 2018