[page:Object3D] →

[name]

A mesh that has a [page:Skeleton] with [page:Bone bones] that can then be used to animate the vertices of the geometry.

Example

var geometry = new THREE.CylinderGeometry( 5, 5, 5, 5, 15, 5, 30 ); //Create the skin indices and skin weights for ( var i = 0; i < geometry.vertices.length; i ++ ) { // Imaginary functions to calculate the indices and weights var skinIndex = calculateSkinIndex( geometry.vertices, i ); var skinWeight = calculateSkinWeight( geometry.vertices, i ); // Ease between each bone geometry.skinIndices.push( new THREE.Vector4( skinIndex, skinIndex + 1, 0, 0 ) ); geometry.skinWeights.push( new THREE.Vector4( 1 - skinWeight, skinWeight, 0, 0 ) ); } var mesh = THREE.SkinnedMesh( geometry, material ); // See example from THREE.Skeleton for the armSkeleton var rootBone = armSkeleton.bones[ 0 ]; mesh.add( rootBone ); // Bind the skeleton to the mesh mesh.bind( armSkeleton ); // Move the bones and manipulate the model armSkeleton.bones[ 0 ].rotation.x = -0.1; armSkeleton.bones[ 1 ].rotation.x = 0.2;

Constructor

[name]([page:Geometry geometry], [page:Material material], [page:boolean useVertexTexture])

geometry — An instance of [page:Geometry]. [page:Geometry.skinIndices] and [page:Geometry.skinWeights] should be set.
material — An instance of [page:Material] (optional).
useVertexTexture -- Defines whether a vertex texture can be used (optional).

Properties

[property:array bones]

This contains the array of bones for this mesh. These should be set in the constructor.

[property:Matrix4 identityMatrix]

This is an identityMatrix to calculate the bones matrices from.

[property:boolean useVertexTexture]

The boolean defines whether a vertex texture is used to calculate the bones. This boolean shouldn't be changed after constructor.

[property:array boneMatrices]

This array of matrices contains the matrices of the bones. These get calculated in the constructor.

[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].

[property:Matrix4 bindMatrix]

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

[property:Matrix4 inverseBindMatrix]

The inverse of the bindMatrix.

Methods

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

skeleton — [page:Skeleton]
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.

[method:null normalizeSkinWeights]()

Normalizes the [page:Geometry.skinWeights] vectors. Does not affect [page:BufferGeometry].

[method:null pose]()

This method sets the skinned mesh in the rest pose.

[method:Bone addBone]([page:Bone bone])

bone — This is the bone that needs to be added. (optional)
This method adds the bone to the skinned mesh when it is provided. It creates a new bone and adds that when no bone is given.

[method:Object3D clone]([page:Object3D object])

object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned SkinnedMesh Object.
Clone a SkinnedMesh Object.

Source

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