[name]
Use an array of [page:Bone bones] to create a skeleton that can be used by a [page:SkinnedMesh].
WebGL only.
Example
// Create a simple "arm"
var bones = [];
var shoulder = new THREE.Bone();
var elbow = new THREE.Bone();
var hand = new THREE.Bone();
shoulder.add( elbow );
elbow.add( hand );
bones.push( shoulder );
bones.push( elbow );
bones.push( hand );
shoulder.position.y = -5;
elbow.position.y = 0;
hand.position.y = 5;
var armSkeleton = new THREE.Skeleton( bones );
// See THREE.SkinnedMesh for an example of usage with a mesh
Constructor
[name]( [page:Array bones], [page:Array boneInverses], [page:Boolean useVertexTexture] )
bones — The array of [page:bone bones]
boneInverses — (optional) An array of [page:Matrix4 Matrix4s]
useVertexTexture — (optional) Whether or not to use a vertex texture in the shader.
The constructor automatically sets up all of the properties below.
Properties
[property:Array bones]
The array of [page:bone bones]
[property:Boolean useVertexTexture]
Whether or not to use a vertex texture in the shader, set in the constructor. Not all devices
support floating point pixel textures. If this option is set then the bone matrices will be packed into
a texture and sent to the shader. This method allows a much larger set of bones to be used. Otherwise
the vertex shader will use uniforms, which do not allow for as many bones to be used. The exact
numbers vary between devices.
[property:Array boneInverses]
An array of [page:Matrix4 Matrix4s] that represent the inverse of the matrixWorld of the individual bones.
[property:Integer boneTextureWidth]
The width of the vertex data texture.
[property:Integer boneTextureHeight]
The height of the vertex data texture.
[property:Float32Array boneMatrices]
The array buffer holding the bone data when using a vertex texture.
[property:DataTexture boneTexture]
The [page:DataTexture] holding the bone data when using a vertex texture.
Methods
[method:null calculateInverses]()
Generates the boneInverses.
[method:null pose]()
Returns the skeleton to the base pose.
[method:null update]()
Updates the [page:Float32Array boneMatrices] and [page:DataTexture boneTexture] after changing the bones.
This is called automatically by the [page:WebGLRenderer] if the skeleton is used with a [page:SkinnedMesh].
[method:Skeleton clone]()
Returns a clone of this Skeleton object.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]