Capítulo 13 de 859

Chapter 13: SkinnedMesh

Core Idea

A mesh that has a Skeleton that can then be used to animate the vertices of the geometry with skinning/skeleton animation.

Next to a valid skeleton, the skinned mesh requires skin indices and weights as buffer attributes in its geometry. These attribute define which bones affect a single vertex to a certain extend.

Typically skinned meshes are not created manually but loaders like GLTFLoader or FBXLoader import respective models.

Key Concepts

  • bindMatrix : Matrix4: The base matrix that is used for the bound bone transforms.
  • bindMatrixInverse : Matrix4: The base matrix that is used for resetting the bound bone transforms.
  • bindMode : AttachedBindMode | DetachedBindMode: AttachedBindMode means the skinned mesh shares the same world space as the skeleton. This is not true when using DetachedBindMode which…
  • boundingBox : Box3: The bounding box of the skinned mesh. Can be computed via SkinnedMesh#computeBoundingBox.
  • boundingSphere : Sphere: The bounding sphere of the skinned mesh. Can be computed via SkinnedMesh#computeBoundingSphere.
  • isSkinnedMesh : boolean (readonly): This flag can be used for type testing.

Reference Tables

Constructor

Signature
`new SkinnedMesh( geometry : BufferGeometry, material : Material

Properties

PropertyDescription
.bindMatrix : Matrix4The base matrix that is used for the bound bone transforms.
.bindMatrixInverse : Matrix4The base matrix that is used for resetting the bound bone transforms.
`.bindMode : AttachedBindModeDetachedBindMode`
.boundingBox : Box3The bounding box of the skinned mesh. Can be computed via SkinnedMesh#computeBoundingBox.
.boundingSphere : SphereThe bounding sphere of the skinned mesh. Can be computed via SkinnedMesh#computeBoundingSphere.
.isSkinnedMesh : boolean (readonly)This flag can be used for type testing.

Methods

MethodDescription
`.applyBoneTransform( index : number, target : Vector3Vector4 ) : Vector3
.bind( skeleton : Skeleton, bindMatrix : Matrix4 )Binds the given skeleton to the skinned mesh.
.computeBoundingBox()Computes the bounding box of the skinned mesh, and updates SkinnedMesh#boundingBox. The bounding box is not automatically computed by the engine; this method must be c…
.computeBoundingSphere()Computes the bounding sphere of the skinned mesh, and updates SkinnedMesh#boundingSphere. The bounding sphere is automatically computed by the engine once when it i…
.normalizeSkinWeights()Normalizes the skin weights which are defined as a buffer attribute in the skinned mesh's geometry.
.pose()This method sets the skinned mesh in the rest pose).

Key Takeaways

  1. SkinnedMesh extends: EventDispatcher → Object3D → Mesh
  2. Most relevant properties: bindMatrix, bindMatrixInverse, bindMode, boundingBox.
  3. Key methods: applyBoneTransform, bind, computeBoundingBox, computeBoundingSphere.

Connects To