๐ฆด Inverse Kinematics
Inverse Kinematics (IK) is the process of calculating the position of the bones of a mesh based on constraints. A way to define constraints is by using joints.
In forward kinematics, you set each boneโs rotation directly โ rotate the shoulder, then the elbow, then the wrist. In inverse kinematics, you specify where the end should be (e.g., โthe hand should be on this ledgeโ) and the algorithm calculates the rotations for all bones in the chain to reach that target.
Common Use Cases
- Foot placement โ adjusting a characterโs legs so feet land correctly on uneven terrain rather than clipping through slopes or floating above stairs.
- Reaching and grabbing โ making a characterโs hand reach toward a door handle, weapon pickup, or another character.
- Look-at โ rotating a characterโs head and spine to look at a target naturally.
- Procedural animation โ spider legs, tentacles, and robotic arms that adapt dynamically to the environment rather than relying on pre-baked animations.
Algorithms
- CCD (Cyclic Coordinate Descent) โ iteratively adjusts each joint from the end of the chain to the root, rotating each one to bring the end effector closer to the target. Simple and fast.
- FABRIK (Forward And Backward Reaching Inverse Kinematics) โ works by alternately reaching from the end to the target and then correcting from the root. Handles chains and constraints well.
- Closed-chain IK โ handles loops in the bone structure (e.g., two hands holding the same object), which is more complex than simple open chains.