Every frame the target moves, the chain re-solves from its own current pose (it is not reset to a rest shape first) using the real two-phase FABRIK loop from Aristidou & Lasenby (2011):
forward pass (tip → base): p[n] = target
for i = n-1 .. 0:
r = |p[i] - p[i+1]|
λ = L[i] / r
p[i] = (1-λ)·p[i+1] + λ·p[i]
backward pass (base → tip): p[0] = fixedBase
for i = 0 .. n-1:
r = |p[i+1] - p[i]|
λ = L[i] / r
p[i+1] = (1-λ)·p[i] + λ·p[i+1]
repeat until |p[n] - target| < tolerance, or maxIterations reached
- No trigonometry and no rotation matrices anywhere — every step only ever finds a point on a line segment of the correct link length. That's the whole algorithm.
- The iteration counter is the real loop count the solver just ran, not a cosmetic number: drag the target near the chain and it converges in 1-2 passes; drag it to a far corner and it takes many more, exactly as the geometry predicts.
- If the target sits farther than the sum of all link lengths, FABRIK's own unreachable-case shortcut fires: the chain fully extends in a straight line toward the target and the loop is skipped (it can't converge, so it doesn't pretend to) — the panel reports this directly as "Target status: Out of reach".
- Optional joint limits clamp each joint's bend angle after the backward pass and re-run a short local correction — a real addition FABRIK's original geometric-only form doesn't include but production IK rigs need.