Building an IK biped from scratch
- #game-dev
- #procedural-animation
This is a sample build log for the new writing section. It marks out the shape of the eventual post: a practical explanation, a small amount of maths, and the messy notes that made the finished system possible.
Two bones, one target
A two-bone inverse-kinematics solver starts with a pleasantly small problem. There is a fixed root, two segment lengths, and a point the end of the chain should reach.
The target distance is clamped to the chain’s reachable range. From there, the law of cosines gives the angle at the first joint:
const reach = clamp(distance, Math.abs(a - b), a + b);
const cosine = (a * a + reach * reach - b * b) / (2 * a * reach);
const shoulder = targetAngle - Math.acos(cosine);
That gets the chain into the correct place. It does not make it feel alive.
Correct is only the start
Procedural animation becomes convincing in the transition between poses. Targets need a little lag. Feet need a reason to stay planted. A bend direction should change because the character’s intent changed, not because one floating-point value crossed zero.
The eventual write-up will unpack those layers with a live Godot example. For now, this post is a useful fixture for headings, paragraphs, inline code, and fenced code blocks.
The solver provides the pose. Timing provides the character.
Next pass
The next version will add diagrams, source links, and a playable web export alongside the explanation.