Skip to content

Documentation / scene / FABRIKSolver

Class: FABRIKSolver

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:29

FABRIK (Forward And Backward Reaching Inverse Kinematics) solver.

Remarks

FABRIK is an iterative IK algorithm that alternates between:

  1. Forward pass: Move from end effector to root, pulling joints toward target
  2. Backward pass: Move from root to end effector, restoring root position

Supports multiple pole vectors to control the bending direction of different joints.

Extends

Constructors

Constructor

new FABRIKSolver(chain, maxIterations?, tolerance?): FABRIKSolver

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:42

Create a FABRIK solver.

Parameters

chain

IKChain

The IK chain to solve

maxIterations?

number = 15

Maximum number of iterations (default: 15)

tolerance?

number = 0.001

Convergence tolerance in world units (default: 0.001)

Returns

FABRIKSolver

Overrides

IKSolver.constructor

Properties

_chain

protected _chain: IKChain

Defined in: libs/scene/src/animation/ik/ik_solver.ts:11

The IK chain to solve

Inherited from

IKSolver._chain


_maxIterations

protected _maxIterations: number

Defined in: libs/scene/src/animation/ik/ik_solver.ts:13

Maximum number of iterations

Inherited from

IKSolver._maxIterations


_tolerance

protected _tolerance: number

Defined in: libs/scene/src/animation/ik/ik_solver.ts:15

Convergence tolerance (distance threshold)

Inherited from

IKSolver._tolerance

Accessors

chain

Get Signature

get chain(): IKChain

Defined in: libs/scene/src/animation/ik/ik_solver.ts:33

Get the IK chain.

Returns

IKChain

Inherited from

IKSolver.chain

Methods

setTwistConstraint()

setTwistConstraint(jointIndex, minTwist, maxTwist, smoothFactor?): void

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:67

Set twist constraint for a specific joint.

Parameters

jointIndex

number

Index of the joint

minTwist

number

Minimum twist angle in radians

maxTwist

number

Maximum twist angle in radians

smoothFactor?

number = 0.3

Smoothing factor [0-1] (default: 0.3)

Returns

void


getTwistConstraint()

getTwistConstraint(jointIndex): TwistConstraint

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:90

Get twist constraint for a specific joint.

Parameters

jointIndex

number

Index of the joint

Returns

TwistConstraint

Twist constraint or undefined if not set


removeTwistConstraint()

removeTwistConstraint(jointIndex): boolean

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:100

Remove twist constraint for a specific joint.

Parameters

jointIndex

number

Index of the joint

Returns

boolean

True if a constraint was removed


clearTwistConstraints()

clearTwistConstraints(): void

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:107

Clear all twist constraints.

Returns

void


setPoleVector()

setPoleVector(jointIndex, poleVector, weight?): void

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:118

Set pole vector for a specific joint.

Parameters

jointIndex

number

Index of the joint to apply pole vector to

poleVector

Vector3

Pole vector position in world space

weight?

number = 1

Weight of the pole vector constraint (0-1, default: 1)

Returns

void


removePoleVector()

removePoleVector(jointIndex): boolean

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:135

Remove pole vector for a specific joint.

Parameters

jointIndex

number

Index of the joint to remove pole vector from

Returns

boolean

True if a pole vector was removed, false if none existed


clearPoleVectors()

clearPoleVectors(): void

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:142

Clear all pole vectors.

Returns

void


getPoleVector()

getPoleVector(jointIndex): object

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:152

Get pole vector configuration for a specific joint.

Parameters

jointIndex

number

Index of the joint

Returns

object

Pole vector configuration or undefined if not set

position

position: Vector3

weight

weight: number


hasPoleVector()

hasPoleVector(jointIndex): boolean

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:169

Check if a joint has a pole vector.

Parameters

jointIndex

number

Index of the joint

Returns

boolean

True if the joint has a pole vector


solve()

solve(target): boolean

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:179

Solve the IK chain to reach the target position using FABRIK algorithm.

Parameters

target

Vector3

Target position for the end effector

Returns

boolean

True if converged within tolerance, false otherwise

Overrides

IKSolver.solve


applyToNodes()

applyToNodes(weight?): void

Defined in: libs/scene/src/animation/ik/fabrik_solver.ts:222

Apply the solved joint positions to scene nodes as rotations.

Parameters

weight?

number = 1

Blend weight (0 = original, 1 = full IK, default: 1)

Returns

void

Overrides

IKSolver.applyToNodes


setMaxIterations()

setMaxIterations(value): void

Defined in: libs/scene/src/animation/ik/ik_solver.ts:40

Set maximum number of iterations.

Parameters

value

number

Returns

void

Inherited from

IKSolver.setMaxIterations


getMaxIterations()

getMaxIterations(): number

Defined in: libs/scene/src/animation/ik/ik_solver.ts:47

Get maximum number of iterations.

Returns

number

Inherited from

IKSolver.getMaxIterations


setTolerance()

setTolerance(value): void

Defined in: libs/scene/src/animation/ik/ik_solver.ts:54

Set convergence tolerance.

Parameters

value

number

Returns

void

Inherited from

IKSolver.setTolerance


getTolerance()

getTolerance(): number

Defined in: libs/scene/src/animation/ik/ik_solver.ts:61

Get convergence tolerance.

Returns

number

Inherited from

IKSolver.getTolerance

Released under the MIT License.