Taos API Reference
    Preparing search index...

    Class Skeleton

    GLTF-style joint hierarchy with rest pose and inverse-bind matrices.

    Joints are stored as a flat array; parentIndices encodes the hierarchy (-1 = root). The skeleton itself is static — animation state lives in TRS arrays passed into Skeleton.computeJointMatrices, which produces the final joint matrices used for skinning. The skin layout matches the source GLTF: parents always appear before their children.

    Index

    Constructors

    • Parameters

      • parentIndices: Int16Array

        Parent joint per joint (-1 for roots); also defines jointCount.

      • invBindMats: Float32Array

        Inverse-bind matrices, jointCount × 16 column-major.

      • restTranslations: Float32Array

        Rest-pose translations, jointCount × 3.

      • restRotations: Float32Array

        Rest-pose rotations (xyzw), jointCount × 4.

      • restScales: Float32Array

        Rest-pose scales, jointCount × 3.

      • OptionalrootTransform: Float32Array<ArrayBufferLike>

        Optional ancestor transform above the root joint; defaults to identity.

      • OptionaljointNames: readonly (string | undefined)[]

        Optional per-joint names (from the source glTF nodes) enabling jointIndex lookup.

      Returns Skeleton

    Properties

    jointCount: number
    parentIndices: Int16Array

    Parent joint index per joint, or -1 for roots.

    invBindMats: Float32Array

    Inverse-bind matrices, jointCount × 16 column-major.

    rootTransform: Float32Array

    Accumulated ancestor transform above the skeleton root joint (16 floats, column-major).

    restTranslations: Float32Array

    Rest-pose translations from GLTF node defaults (jointCount × 3).

    restRotations: Float32Array

    Rest-pose rotations from GLTF node defaults (jointCount × 4, xyzw).

    restScales: Float32Array

    Rest-pose scales from GLTF node defaults (jointCount × 3).

    jointNames?: readonly (string | undefined)[]

    Joint names from the source glTF nodes (jointCount), undefined per joint when the node was unnamed.

    Methods

    • Resolves a joint index by its source glTF node name, or -1 if unknown.

      Requires jointNames (populated by the glTF loader). The first joint with a matching name wins. Used to attach a BoneAttachment (gun muzzle, weapon socket) to a named bone without hard-coding indices.

      Parameters

      • name: string

      Returns number

    • Computes final skinning matrices (global × invBind per joint) from per-joint TRS arrays.

      Parents must appear before children in the joint list (guaranteed by GLTF).

      Parameters

      • translations: Float32Array

        Per-joint translations (jointCount × 3).

      • rotations: Float32Array

        Per-joint rotations as xyzw quaternions (jointCount × 4).

      • scales: Float32Array

        Per-joint scales (jointCount × 3).

      • out: Float32Array

        Destination buffer for the final joint matrices (jointCount × 16, column-major).

      • OptionaloutGlobal: Float32Array<ArrayBufferLike>

        Optional destination for the per-joint global (model-space) matrices (before multiplying by the inverse-bind). These are the bone poses a BoneAttachment reads to follow a joint (gun muzzle, weapon socket).

      Returns void