Strata - v1.4.10
    Preparing search index...

    Class CCDSolver

    Cyclic Coordinate Descent (CCD) IK Solver.

    Alternative IK algorithm that iterates from end to root, rotating each joint to point toward the target. Often faster than FABRIK but can produce less natural-looking results.

    When to use CCD:

    • Chains with many segments (5+ bones) where speed matters
    • Mechanical/robotic motion (less organic than FABRIK)
    • Spines, tails, or tentacles that need quick response
    • When pole targets aren't needed

    Algorithm Overview:

    1. Start at the joint nearest the end effector
    2. Rotate that joint to point end effector toward target
    3. Move to next joint toward root, repeat
    4. Loop until converged or max iterations
    // Long mechanical arm with many segments
    const armChain = createBoneChainFromLengths(
    armRoot,
    [0.2, 0.2, 0.2, 0.2, 0.2] // 5 equal segments
    );

    const solver = new CCDSolver(
    0.002, // tolerance
    25, // max iterations (CCD may need more than FABRIK)
    0.8 // damping factor (0.8 = smoother, less snappy)
    );

    const result = solver.solve(armChain, targetPos);
    solver.apply(armChain, result);
    // Character spine bending toward look target
    const spineChain = createBoneChainFromLengths(
    spineRoot,
    [0.1, 0.1, 0.1, 0.1, 0.1] // 5 spine segments
    );

    // CCD is great for spines - fast and responsive
    const solver = new CCDSolver(0.001, 15, 1.0);
    const result = solver.solve(spineChain, headTarget);
    solver.apply(spineChain, result);
    Index

    Constructors

    Methods

    Constructors

    • Create a new CCD solver.

      Parameters

      • tolerance: number = 0.001

        Distance threshold for convergence (meters). Default: 0.001

      • maxIterations: number = 20

        Maximum solver iterations per frame. Default: 20

      • dampingFactor: number = 1.0

        Rotation damping (0-1). Lower = smoother but slower. Default: 1.0

      Returns CCDSolver

    Methods

    • Solve IK for a bone chain to reach a target position.

      Uses cyclic coordinate descent to iteratively rotate joints toward the target.

      Parameters

      • chain: BoneChain

        The bone chain to solve

      • target: Vector3

        World position the end effector should reach

      Returns IKSolverResult

      Solver result with positions, rotations, and convergence info

      const solver = new CCDSolver(0.002, 25, 0.8);
      const result = solver.solve(tentacleChain, foodPosition);

      if (result.reached) {
      solver.apply(tentacleChain, result);
      }