class

FABRIK

FABRIK solver. Iterative, positions-only, then converts to bone rotations.

Module
Animation
Header
#include "Animation/IK/FABRIK.h"
Namespace
Mowo

Algorithm (per iteration): 1. Backward pass: place end at target. For i = end-1 .. root, snap each joint to a distance len[i] toward the next joint. 2. Forward pass: snap root back to its original position. For i = root+1 .. end, snap each joint to len[i-1] away from the previous joint. 3. Stop when |end - target| < tolerance or maxIterations reached.

Joint limits, when present, are enforced inside the FORWARD pass — the one that runs last and therefore owns the final positions. Constraining the backward pass too would fight the target and stall convergence; letting the forward pass clamp means an over-constrained chain simply stops short of an unreachable target instead of tearing. The pole hint runs after the solve and rotates the whole chain rigidly about the root→end axis, so it cannot break a cone limit (those are relative angles) but CAN swing a hinge out of its plane — a hinge already fixes the bend plane, so setting both on the same joint is authoring two answers to one question.

After convergence we compute new world rotations: for each non-end joint, the rotation that takes (next-bone-pos in old pose) to (next-bone-pos in new pose). Optional pole hint applies a swing-around-root→end rotation so the middle of the chain faces the pole.

Public functions

ReturnsNameDescription
voidSolve

Function details

Solve

C++
static void Solve(const Skeleton& skeleton, const FABRIKChain& chain, const Vec3& targetPos, std::vector<Mat4>& localTransforms)
Generated from Animation/IK/FABRIK.h via animation.json · Oct 26, 2026Version 1.0.0