CLASSES
TagsA - Z

Bone

Description

class Bone extends Node

Constructor

new Bone(name, skeleton, parentBone, matrix, restPose)

Parameters

Name Type Description
name string Name of the bone
skeleton Skeleton The skeleton the bone belongs to
parentBone Bone The parent bone of this bone
matrix Matrix The update matrix

Members

name : string

The bone name

children : Bone[]

Children bones array

animations : Animation[]

Animations of this bone

length : number

position : Vector3

rotation : Vector3

rotationQuaternion : Quaternion

scaling : Vector3

Methods

getParent() → Bone

Get the parent bone

getLocalMatrix() → Matrix

Get the local matrix

getBaseMatrix() → Matrix

Get the base matrix

getRestPose() → Matrix

returnToRest() → void

getWorldMatrix() → Matrix

Get the world matrix

getInvertedAbsoluteTransform() → Matrix

Get the inverted absolute transform

getAbsoluteTransform() → Matrix

updateMatrix(matrix, updateDifferenceMatrix) → void

Parameters

Name Type Description
matrix Matrix The update matrix
optional updateDifferenceMatrix boolean

markAsDirty() → void

copyAnimationRange(source, rangeName, frameOffset, rescaleAsRequired, skelDimensionsRatio) → boolean

Parameters

Name Type Description
source Bone
rangeName string
frameOffset number
optional rescaleAsRequired boolean

translate(vec, space, mesh) → void

Translate the bone in local or world space.

Parameters

Name Type Description
vec Vector3 The amount to translate the bone.
optional space Space The space that the translation is in.
optional mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.

setPosition(position, space, mesh) → void

Set the postion of the bone in local or world space.

Parameters

Name Type Description
position Vector3 The position to set the bone.
optional space Space The space that the position is in.
optional mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.

setAbsolutePosition(position, mesh) → void

Set the absolute postion of the bone (world space).

Parameters

Name Type Description
position Vector3 The position to set the bone.
optional mesh AbstractMesh The mesh that this bone is attached to.

setScale(x, y, z, scaleChildren) → void

Set the scale of the bone on the x, y and z axes.

Parameters

Name Type Description
x number The scale of the bone on the x axis. The scale of the bone on the y axis.
y number
z number The scale of the bone on the z axis.

scale(x, y, z, scaleChildren) → void

Scale the bone on the x, y and z axes.

Parameters

Name Type Description
x number The amount to scale the bone on the x axis. The amount to scale the bone on the y axis.
y number
z number The amount to scale the bone on the z axis.

setYawPitchRoll(yaw, pitch, roll, space, mesh) → void

Set the yaw, pitch, and roll of the bone in local or world space.

Parameters

Name Type Description
yaw number The rotation of the bone on the y axis.
pitch number The rotation of the bone on the x axis.
roll number The rotation of the bone on the z axis.
optional space Space The space that the axes of rotation are in.

rotate(axis, amount, space, mesh) → void

Rotate the bone on an axis in local or world space.

Parameters

Name Type Description
axis Vector3 The axis to rotate the bone on.
amount number The amount to rotate the bone.
optional space Space The space that the axis is in.

setAxisAngle(axis, angle, space, mesh) → void

Set the rotation of the bone to a particular axis angle in local or world space.

Parameters

Name Type Description
axis Vector3 The axis to rotate the bone on.
angle number The angle that the bone should be rotated to.
optional space Space The space that the axis is in.

setRotation(rotation, space, mesh) → void

Set the euler rotation of the bone in local of world space.

Parameters

Name Type Description
rotation Vector3 The euler rotation that the bone should be set to.
optional space Space The space that the rotation is in.
optional mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.

setRotationQuaternion(quat, space, mesh) → void

Set the quaternion rotation of the bone in local of world space.

Parameters

Name Type Description
quat Quaternion The quaternion rotation that the bone should be set to.
optional space Space The space that the rotation is in.
optional mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.

setRotationMatrix(rotMat, space, mesh) → void

Set the rotation matrix of the bone in local of world space.

Parameters

Name Type Description
rotMat Matrix The rotation matrix that the bone should be set to.
optional space Space The space that the rotation is in.
optional mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.

getScale() → Vector3

Get the scale of the bone

@returns the scale of the bone

getScaleToRef(result) → void

Copy the scale of the bone to a vector3.

Parameters

Name Type Description
result Vector3 The vector3 to copy the scale to

getPosition(space, mesh) → Vector3

Get the position of the bone in local or world space.

@returns The position of the bone

Parameters

Name Type Description
optional space Space The space that the returned position is in.
optional mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.

getPositionToRef(space, mesh, result) → void

Copy the position of the bone to a vector3 in local or world space.

Parameters

Name Type Description
space Space The space that the returned position is in.
mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.
result Vector3 The vector3 to copy the position to.

getAbsolutePosition(mesh) → Vector3

Get the absolute position of the bone (world space).

@returns The absolute position of the bone

Parameters

Name Type Description
optional mesh AbstractMesh The mesh that this bone is attached to.

getAbsolutePositionToRef(mesh, result) → void

Copy the absolute position of the bone (world space) to the result param.

Parameters

Name Type Description
mesh AbstractMesh The mesh that this bone is attached to.
result Vector3 The vector3 to copy the absolute position to.

computeAbsoluteTransforms() → void

Compute the absolute transforms of this bone and its children.

getDirection(localAxis, mesh) → Vector3

Get the world direction from an axis that is in the local space of the bone.

@returns The world direction

Parameters

Name Type Description
localAxis Vector3 The local direction that is used to compute the world direction.
optional mesh AbstractMesh The mesh that this bone is attached to.

getDirectionToRef(localAxis, mesh, result) → void

Copy the world direction to a vector3 from an axis that is in the local space of the bone.

Parameters

Name Type Description
localAxis Vector3 The local direction that is used to compute the world direction.
mesh AbstractMesh The mesh that this bone is attached to.
result Vector3 The vector3 that the world direction will be copied to.

getRotation(space, mesh) → Vector3

Get the euler rotation of the bone in local or world space.

@returns The euler rotation

Parameters

Name Type Description
optional space Space The space that the rotation should be in.
optional mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.

getRotationToRef(space, mesh, result) → void

Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space.

Parameters

Name Type Description
space Space The space that the rotation should be in.
mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.
result Vector3 The vector3 that the rotation should be copied to.

getRotationQuaternion(space, mesh) → Quaternion

Get the quaternion rotation of the bone in either local or world space.

@returns The quaternion rotation

Parameters

Name Type Description
optional space Space The space that the rotation should be in.
optional mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.

getRotationQuaternionToRef(space, mesh, result) → void

Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space.

Parameters

Name Type Description
space Space The space that the rotation should be in.
mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.
result Quaternion The quaternion that the rotation should be copied to.

getRotationMatrix(space, mesh) → Matrix

Get the rotation matrix of the bone in local or world space.

@returns The rotation matrix

Parameters

Name Type Description
space Space The space that the rotation should be in.
mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.

getRotationMatrixToRef(space, mesh, result) → void

Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space.

Parameters

Name Type Description
space Space The space that the rotation should be in.
mesh AbstractMesh The mesh that this bone is attached to. This is only used in world space.
result Matrix The quaternion that the rotation should be copied to.

getAbsolutePositionFromLocal(position, mesh) → Vector3

Get the world position of a point that is in the local space of the bone.

@returns The world position

Parameters

Name Type Description
position Vector3 The local position
optional mesh AbstractMesh The mesh that this bone is attached to.

getAbsolutePositionFromLocalToRef(position, mesh, result) → void

Get the world position of a point that is in the local space of the bone and copy it to the result param.

Parameters

Name Type Description
position Vector3 The local position
mesh AbstractMesh The mesh that this bone is attached to.
result Vector3 The vector3 that the world position should be copied to.

getLocalPositionFromAbsolute(position, mesh) → Vector3

Get the local position of a point that is in world space.

@returns The local position

Parameters

Name Type Description
position Vector3 The world position
optional mesh AbstractMesh The mesh that this bone is attached to.

getLocalPositionFromAbsoluteToRef(position, mesh, result) → void

Get the local position of a point that is in world space and copy it to the result param.

Parameters

Name Type Description
position Vector3 The world position
mesh AbstractMesh The mesh that this bone is attached to.
result Vector3 The vector3 that the local position should be copied to.