[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 mesh.bind( armSkeleton ); // Add the root bone, then recalculate the skeleton inverses mesh.add( armSkeleton.bones[0] ); mesh.updateMatrixWorld( true ); // ensure the bones matrices are already recomputed skeleton.calculateInverses(); // 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.

Methods

[method:null pose]()

This method sets the skinnedmesh 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 skinnedmesh when it is provided. It creates a new bone and adds that when no bone is given.

Source

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