math docs
    Preparing search index...

    Type Alias Chain3

    A chain of bones, from the base (index 0) to the end effector (the last bone's end).

    Allocate one with createChain3, fill it with addBone or addConsecutiveBone, then solve it every frame.

    bones[0].joint is unused - the first bone is governed by the chain's basebone fields instead, so a joint's fields never change meaning with its index.

    type Chain3 = {
        base: vec3.Vec3;
        baseboneAnticlockwise: number;
        baseboneAxis: vec3.Vec3;
        baseboneClockwise: number;
        baseboneConstraintType: fabrik3.BaseboneConstraintType;
        baseboneReferenceAxis: vec3.Vec3;
        baseboneRotor: number;
        baseboneWorldAxis: vec3.Vec3;
        baseboneWorldReferenceAxis: vec3.Vec3;
        bestSolution: number[];
        bones: Bone3[];
        embeddedTarget: vec3.Vec3;
        fixedBase: boolean;
        length: number;
        maxIterations: number;
        minIterationChange: number;
        solveDistance: number;
        solveDistanceThreshold: number;
        useEmbeddedTarget: boolean;
    }
    Index
    base: vec3.Vec3

    Where the base of the chain is pinned when fixedBase is set.

    baseboneAnticlockwise: number

    The basebone hinge's anticlockwise limit, in [0, PI].

    baseboneAxis: vec3.Vec3

    The cone axis or hinge axis, in the space named by baseboneConstraintType. Unit length.

    baseboneClockwise: number

    The basebone hinge's clockwise limit, in [0, PI].

    baseboneConstraintType: fabrik3.BaseboneConstraintType

    How the first bone is held; see BaseboneConstraintType.

    baseboneReferenceAxis: vec3.Vec3

    The hinge reference axis, in the space named by baseboneConstraintType. Unit length.

    baseboneRotor: number

    The half-angle of the basebone cone, in [0, PI].

    baseboneWorldAxis: vec3.Vec3

    baseboneAxis in world space. Equal to it for GLOBAL_ types; resolved by solveStructure for LOCAL_ ones.

    baseboneWorldReferenceAxis: vec3.Vec3

    baseboneReferenceAxis in world space.

    bestSolution: number[]

    Scratch holding the best pose solve has seen, six numbers per bone. Grown by addBone.

    bones: Bone3[]

    The bones, base first and end effector last.

    Neighbours share a point - bone i's end is bone i + 1's start - and the solver keeps it that way, so moving one moves the other.

    embeddedTarget: vec3.Vec3

    The target this chain solves for inside a Structure3 when useEmbeddedTarget is set.

    fixedBase: boolean

    Whether backward pins the base to base. Clear it to let the whole chain drift. Forced on for a chain connected in a structure.

    length: number

    The sum of every bone length - the chain's reach. Maintained by addBone.

    maxIterations: number

    The most iterations solve will run.

    minIterationChange: number

    How still an iteration must be before solve treats the chain as stuck.

    Only consulted on an iteration that fails to beat the best distance so far, and compared against the previous iteration rather than the best - so a solve that is slowly getting worse runs its full budget. That is deliberate: FABRIK often worsens before it improves, and every stricter rule tried here bought fewer iterations at a disproportionate cost in final pose.

    solveDistance: number

    The distance from the effector to the target after the last solve.

    solveDistanceThreshold: number

    solve stops as soon as the effector is this close to the target.

    useEmbeddedTarget: boolean

    Whether this chain solves for its own embeddedTarget instead of the target passed to solveStructure. Ignored outside a Structure3.