Use an array of bones to create a Skeleton that can be used by a SkinnedMesh.

Example

// Create a simple "arm"
const bones = [];
const shoulder = new THREE.Bone();
const elbow = new THREE.Bone();
const hand = new THREE.Bone();
shoulder.add(elbow);
elbow.add(hand);
bones.push(shoulder);
bones.push(elbow);
bones.push(hand);
shoulder.position.y = -5;
elbow.position.y = 0;
hand.position.y = 5;
const armSkeleton = new THREE.Skeleton(bones);
See the[page: SkinnedMesh] page
for an example of usage with standard[page: BufferGeometry].

See

Constructors

  • Creates a new Skeleton.

    Parameters

    • Optional bones: Bone[]

      The array of bones. Default [].

    • Optional boneInverses: Matrix4[]

      An array of Matrix4s. Default [].

    Returns Skeleton

Properties

boneInverses: Matrix4[]

An array of Matrix4s that represent the inverse of the matrixWorld of the individual bones.

boneMatrices: Float32Array

The array buffer holding the bone data when using a vertex texture.

boneTexture: null | DataTexture

The DataTexture holding the bone data when using a vertex texture.

bones: Bone[]

The array of Bones.

Remarks

Note this is a copy of the original array, not a reference, so you can modify the original array without effecting this one.

frame: number
uuid: string

UUID of this object instance.

Remarks

This gets automatically assigned and shouldn't be edited.

Methods

  • Generates the boneInverses array if not provided in the constructor.

    Returns void

  • Returns a clone of this Skeleton object.

    Returns Skeleton

  • Computes an instance of DataTexture in order to pass the bone data more efficiently to the shader

    Returns this

    Remarks

    The texture is assigned to boneTexture.

  • Frees the GPU-related resources allocated by this instance

    Returns void

    Remarks

    Call this method whenever this instance is no longer used in your app.

  • Parameters

    • json: unknown
    • bones: Record<string, Bone>

    Returns void

  • Searches through the skeleton's bone array and returns the first with a matching name.

    Parameters

    • name: string

      String to match to the Bone's THREE.Bone.name | .name property.

    Returns undefined | Bone

  • Returns void

  • Returns the skeleton to the base pose.

    Returns void

  • Returns unknown