File: Skeleton.md | Updated: 11/15/2025
Class for representing the armatures in three.js. The skeleton is defined by a hierarchy of bones.
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 , elbow, hand);
shoulder.position.y = -5;
elbow.position.y = 0;
hand.position.y = 5;
const armSkeleton = new THREE.Skeleton( bones );
Constructs a new skeleton.
bones | An array of bones.
---|---
boneInverses | An array of bone inverse matrices. If not provided, these matrices will be computed automatically via Skeleton#calculateInverses.
An array of bone inverse matrices.
An array buffer holding the bone data. Input data for Skeleton#boneTexture.
Default is null.
A texture holding the bone data for use in the vertex shader.
Default is null.
An array of bones defining the skeleton.
Computes the bone inverse matrices. This method resets Skeleton#boneInverses and fills it with new matrices.
Returns a new skeleton with copied values from this instance.
Returns: A clone of this instance.
Computes a data texture for passing bone data to the vertex shader.
Returns: A reference of this instance.
Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
Setups the skeleton by the given JSON and bones.
json | The skeleton as serialized JSON.
---|---
bones | An array of bones.
Returns: A reference of this instance.
Searches through the skeleton's bone array and returns the first with a matching name.
name | The name of the bone.
---|---
Returns: The found bone. undefined if no bone has been found.
Initializes the skeleton. This method gets automatically called by the constructor but depending on how the skeleton is created it might be necessary to call this method manually.
Resets the skeleton to the base pose.
Serializes the skeleton into JSON.
See:
Returns: A JSON object representing the serialized skeleton.
Resets the skeleton to the base pose.