Theme:

Skeleton

An armature defined by a hierarchy of Bone objects. Used by SkinnedMesh for skeletal animation.

Constructor

const skeleton = new Skeleton(bones?, boneInverses?)

If boneInverses is omitted, they are computed automatically.

Properties

  • uuid — UUID string
  • bonesArray<Bone>
  • boneInversesArray<Matrix4> (inverse bind matrices)
  • boneMatricesFloat32Array (flattened bone data)
  • boneTextureDataTexture (bone data for GPU, or null)

Methods

  • init() — Initialize bone matrices (called by constructor)
  • calculateInverses() — Recompute inverse bind matrices from current bone world matrices
  • pose() — Reset to bind pose
  • update() — Flatten current bone transforms into boneMatrices
  • computeBoneTexture() — Create GPU data texture for bone matrices
  • getBoneByName(name) — Find bone by name
  • dispose() — Free GPU resources
  • clone() — Clone skeleton
  • toJSON() / fromJSON(json, bones) — Serialization

Usage

const bones = [shoulder, elbow, hand]
shoulder.add(elbow)
elbow.add(hand)
const skeleton = new Skeleton(bones)