IT lexicon › Programming › Two-bone IK

Two-bone IK

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

The exact, closed-form IK solution for a chain of exactly two bones — the arms-and-legs case, and by far the most common in games.

With only two bones the answer is immediate, no iteration needed. The distance from the shoulder or hip to the target, together with the upper and lower bone lengths, forms a triangle, and the law of cosines gives the knee or elbow angle at once. The whole limb is then rotated to point at the target, and a pole vector decides which way the joint should bend so the knee does not fold backward.

Because the solution is a formula rather than a search, it is exact and runs just once per frame — ideal for planting feet on uneven ground or fixing hands to objects. When the target is out of reach, the limb straightens out. For longer chains it does not apply; there iterative solvers like CCD or FABRIK take over.

← Back to the lexicon