bind method
skeleton
- Skeleton created from a Bones
tree.
bindMatrix
- Matrix4
that represents the base
transform of the skeleton.
Bind a skeleton to the skinned mesh. The bindMatrix gets saved to .bindMatrix property and the .bindMatrixInverse gets calculated.
Implementation
void bind(Skeleton skeleton, [Matrix4? bindMatrix]) {
this.skeleton = skeleton;
if (bindMatrix == null) {
updateMatrixWorld(true);
this.skeleton!.calculateInverses();
bindMatrix = matrixWorld;
}
this.bindMatrix!.setFrom(bindMatrix);
bindMatrixInverse..setFrom(bindMatrix)..invert();
}