[page:Object3D] → [page:Mesh] →

[name]

A mesh that has a [page:Skeleton] with [page:Bone bones] that can then be used to animate the vertices of the geometry. The material must support skinning and have skinning enabled - see [page:MeshStandardMaterial.skinning].

Example

var geometry = new THREE.CylinderBufferGeometry( 5, 5, 5, 5, 15, 5, 30 ); // create the skin indices and skin weights var position = geometry.attributes.position; var vertex = new THREE.Vector3(); var skinIndices = []; var skinWeights = []; for ( var i = 0; i < position.count; i ++ ) { vertex.fromBufferAttribute( position, i ); // compute skinIndex and skinWeight based on some configuration data var y = ( vertex.y + sizing.halfHeight ); var skinIndex = Math.floor( y / sizing.segmentHeight ); var skinWeight = ( y % sizing.segmentHeight ) / sizing.segmentHeight; skinIndices.push( skinIndex, skinIndex + 1, 0, 0 ); skinWeights.push( 1 - skinWeight, skinWeight, 0, 0 ); } geometry.addAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) ); geometry.addAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) ); // create skinned mesh and skeleton var mesh = new THREE.SkinnedMesh( geometry, material ); var skeleton = new THREE.Skeleton( bones ); // see example from THREE.Skeleton var rootBone = skeleton.bones[ 0 ]; mesh.add( rootBone ); // bind the skeleton to the mesh mesh.bind( skeleton ); // move the bones and manipulate the model skeleton.bones[ 0 ].rotation.x = -0.1; skeleton.bones[ 1 ].rotation.x = 0.2;

Constructor

[name]( [param:BufferGeometry geometry], [param:Material material] )

[page:Geometry geometry] - an instance of [page:BufferGeometry].
[page:Material material] - (optional) an instance of [page:Material]. Default is a new [page:MeshBasicMaterial].

Properties

See the base [page:Mesh] class for common properties.

[property:string bindMode]

Either "attached" or "detached". "attached" uses the [page:SkinnedMesh.matrixWorld] property for the base transform matrix of the bones. "detached" uses the [page:SkinnedMesh.bindMatrix]. Default is "attached".

[property:Matrix4 bindMatrix]

The base matrix that is used for the bound bone transforms.

[property:Matrix4 bindMatrixInverse]

The base matrix that is used for resetting the bound bone transforms.

[property:Boolean isSkinnedMesh]

Used to check whether this or derived classes are skinned meshes. Default is *true*.

You should not change this, as it used internally for optimisation.

[property:Skeleton skeleton]

[page:Skeleton] representing the bone hierachy of the skinned mesh.

Methods

See the base [page:Mesh] class for common methods.

[method:null bind]( [param:Skeleton skeleton], [param:Matrix4 bindMatrix] )

[page:Skeleton skeleton] - [page:Skeleton] created from a [page:Bone Bones] tree.
[page:Matrix4 bindMatrix] - [page:Matrix4] that represents the base transform of the skeleton.

Bind a skeleton to the skinned mesh. The bindMatrix gets saved to .bindMatrix property and the .bindMatrixInverse gets calculated. This is called automatically in the constructor, and the skeleton is created from the [page:Geometry.bones bones] of the [page:Geometry] passed in the constructor.

[method:SkinnedMesh clone]()

Returns a clone of this SkinnedMesh object and any descendants.

[method:null normalizeSkinWeights]()

Normalizes the skin weights.

[method:null pose]()

This method sets the skinned mesh in the rest pose (resets the pose).

[method:null updateMatrixWorld]( [param:Boolean force] )

Updates the [page:Matrix4 MatrixWorld].

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]