Bone

Description

class Bone extends Node

Constructor

new Bone(name, skeleton, parentBone, localMatrix, restPose, baseMatrix, index)

Parameters

Name Type Description
name string
skeleton Skeleton
optional parentBone Nullable<Bone>
optional localMatrix Nullable<Matrix>
optional restPose Nullable<Matrix>
optional baseMatrix Nullable<Matrix>

Members

name : string

children : Bone[]

animations : Animation[]

length : number

position : Vector3

rotation : Vector3

rotationQuaternion : Quaternion

scaling : Vector3

Methods

getSkeleton() Skeleton

getParent() Nullable<Bone>

setParent(parent, updateDifferenceMatrix) void

Parameters

Name Type Description
parent Nullable<Bone>
optional updateDifferenceMatrix boolean

getLocalMatrix() Matrix

getBaseMatrix() Matrix

getRestPose() Matrix

returnToRest() void

getWorldMatrix() Matrix

getInvertedAbsoluteTransform() Matrix

getAbsoluteTransform() Matrix

updateMatrix(matrix, updateDifferenceMatrix) void

Parameters

Name Type Description
matrix 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 Nullable<AbstractMesh> The mesh that this bone is attached to. This is only used in world space.

getPositionToRef(space, undefined, 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 ior undefined n.
mesh Nullable<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 Nullable<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 Nullable<AbstractMesh> The mesh that this bone is attached to.

getDirectionToRef(localAxis, mesh) (localAxis, mesh)

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.