Create a new FABRIK solver.
Distance threshold for convergence (meters). Default: 0.001
Maximum solver iterations per frame. Default: 20
Apply solved rotations to the bone chain.
Takes the computed rotations from solve() and applies them to the actual Three.js objects. Call this after solving to update your scene.
The bone chain to modify
The solver result containing rotations
Solve IK for a bone chain to reach a target position.
Computes joint angles needed to position the end effector at the target. If the target is out of reach, the chain stretches as far as possible.
The bone chain to solve
World position the end effector should reach
Optionalpole: Vector3Optional pole target to control mid-joint orientation (e.g., elbow/knee direction)
Solver result with positions, rotations, and convergence info
const solver = new FABRIKSolver();
const result = solver.solve(armChain, targetPos);
// Check if solution is valid
if (result.reached) {
solver.apply(armChain, result);
}
// Monitor performance
console.log(`Converged in ${result.iterations} iterations`);
console.log(`Final error: ${result.error.toFixed(4)}m`);
Forward And Backward Reaching Inverse Kinematics (FABRIK) Solver.
Industry-standard IK algorithm used in games like The Witcher 3 and Uncharted. Provides fast, stable convergence for multi-bone chains like arms, tentacles, tails, and spines.
When to use FABRIK:
Algorithm Overview:
Example
Example
See