Creates a skeleton with every node at the identity pose: no translation or rotation, and a scale of 1
Construction options; see SkeletonOptions.
Whether the local pose changed since the last updateWorld
Set it after writing into the local arrays; setLocalTRS and
animations set it for you. While it's false, the view skips recomputing the matrices.
Readonly AdvancedinverseOne column-major 4x4 matrix per joint, taking a vertex from the bind pose into the joint's space
ReadonlyjointNumber of joints, the nodes that deform the mesh
ReadonlyjointsThe node index of each joint
ReadonlylocalLocal position of each node, three floats per node: x, y, z
ReadonlylocalLocal rotation of each node, a four-float quaternion per node: x, y, z, w
ReadonlylocalLocal scale of each node, three floats per node: x, y, z
A scale that differs between axes skews the lighting of the skin it moves, since the skin's normals aren't corrected for it.
ReadonlynodeNumber of nodes: the joints plus the nodes above them
ReadonlyparentParent of each node, as a node index, or -1 for a root
Readonly AdvancedworldThe skinning matrix of each joint, in joint order: its posed matrix times its inverse bind
Each is three rows of four floats, row-major, without the bottom row, which is always
0, 0, 0, 1. updateWorld fills it, and the view uploads it only
after a fill, so pose the local arrays rather than writing this.
Static AdvanceddefaultDefaults for every new Skeleton, empty to start; an option passed as undefined keeps its
default
Advanced
Makes a node follow a scene-graph container's local position, rotation and scale
A Model3D does this for a node above the joints that also holds meshes, so moving or animating that container moves the skin. The node follows until the skeleton is destroyed.
Index of the node that follows src
The container to follow
Stops the nodes following their containers, without destroying the containers
A Model3D destroys its own skeletons. Calling it again does nothing.
Returns the index of the node with a label
A Model3D labels each node with its name in the file, or node_<n> for an unnamed
one, where n is the node's index in the file.
Node label to look up
The node index for label
Sets a node's local position, rotation and scale, and marks the skeleton dirty
Scale defaults to 1 on each axis, so leaving it out resets any scale the node had. The rotation is used as given, without normalizing, so pass a unit quaternion.
Node index; indexOf finds it from a label
Translation X
Translation Y
Translation Z
Rotation quaternion X
Rotation quaternion Y
Rotation quaternion Z
Rotation quaternion W
Scale X
Scale Y
Scale Z
Advanced
Recomputes worldMatrix from the local pose, if the skeleton is dirty
The view calls it every frame for each skeleton it draws, so call it yourself only to read
worldMatrix before the next render. Bones bound with
bindContainerBone copy their containers' transforms
first, which can make the skeleton dirty.
The bones of a skinned Mesh3D, and their pose
A Model3D builds one per skin in its file and gives it to every mesh that skin deforms, so you rarely build one yourself. The bones are numbered nodes: the joints that deform the mesh, plus the nodes above them. Each node's local position, rotation and scale sit in the flat arrays localPosition, localRotation and localScale.
To pose a bone, write into those arrays and set dirty, or call setLocalTRS, which does both. In a Model3D, a bone with a mesh under it, such as a hand holding a sword, is also one of the model's nodes and follows that node, so move the node instead. The view recomputes a dirty skeleton's matrices before it draws. A playing animation rewrites the bones it drives on every update, so a change you make to one of those lasts only until then.
A skeleton from a Model3D shares its
parent,jointsandinverseBindMatriceswith every model built from the same source, so don't write into them. A skeleton holds no GPU memory.Example
See
SkeletonOptions For constructor options.