Skeleton

THREE.Skeleton
See theSkeleton companion object
class Skeleton(var bones: Array[Bone], var boneInverses: Array[Matrix4]) extends Object

Class for representing the armatures in three.js. The skeleton is defined by a hierarchy of bones.

Example:

val bones = js.Array[Bone]()

val shoulder = new Bone()
val elbow    = new Bone()
val hand     = new Bone()

shoulder.add(elbow)
elbow.add(hand)

bones.push(shoulder, elbow, hand)

shoulder.position.y = -5
elbow.position.y = 0
hand.position.y = 5

val armSkeleton = new Skeleton(bones)

Attributes

Companion
object
Graph
Supertypes
class Object
trait Any
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def calculateInverses(): Unit

Computes the bone inverse matrices. This method resets boneInverses and fills it with new matrices.

Computes the bone inverse matrices. This method resets boneInverses and fills it with new matrices.

Attributes

override def clone(): Skeleton

Returns a new skeleton with copied values from this instance.

Returns a new skeleton with copied values from this instance.

Attributes

Definition Classes
Object

Computes a data texture for passing bone data to the vertex shader.

Computes a data texture for passing bone data to the vertex shader.

Attributes

def dispose(): Unit

Frees the GPU-related resources allocated by this instance.

Frees the GPU-related resources allocated by this instance.

Attributes

def fromJSON(json: Object, bones: Dictionary[Bone]): Skeleton

Setups the skeleton by the given JSON and bones.

Setups the skeleton by the given JSON and bones.

Value parameters

bones

An object map of bones

json

The skeleton as serialized JSON

Attributes

Returns

A reference of this instance

def getBoneByName(name: String): UndefOr[Bone]

Searches through the skeleton's bone array and returns the first with a matching name.

Searches through the skeleton's bone array and returns the first with a matching name.

Value parameters

name

The name of the bone

Attributes

Returns

The found bone, undefined if no bone has been found

def init(): Unit

Initializes the skeleton. This method gets automatically called by the constructor but depending on how the skeleton is created it might be necessary to call this method manually.

Initializes the skeleton. This method gets automatically called by the constructor but depending on how the skeleton is created it might be necessary to call this method manually.

Attributes

def pose(): Unit

Resets the skeleton to the base pose.

Resets the skeleton to the base pose.

Attributes

def toJSON(): Object

Serializes the skeleton into JSON.

Serializes the skeleton into JSON.

Attributes

def update(): Unit

Updates the skeleton bone matrices.

Updates the skeleton bone matrices.

Attributes

Inherited methods

def hasOwnProperty(v: String): Boolean

Attributes

Inherited from:
Object
def isPrototypeOf(v: Object): Boolean

Attributes

Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean

Attributes

Inherited from:
Object
def toLocaleString(): String

Attributes

Inherited from:
Object
def valueOf(): Any

Attributes

Inherited from:
Object

Concrete fields

var boneInverses: Array[Matrix4]
var boneMatrices: Float32Array

An array of bone inverse matrices.

An array of bone inverse matrices.

Attributes

A texture holding the bone data for use in the vertex shader.

A texture holding the bone data for use in the vertex shader.

Attributes

var bones: Array[Bone]
val uuid: String

The UUID of this skeleton instance.

The UUID of this skeleton instance.

Attributes