updateMatrixWorld method

  1. @override
void updateMatrixWorld([
  1. bool force = false
])
override

Implementation

@override
updateMatrixWorld([bool force = false]) {
  var bones = this.bones;

  var geometry = this.geometry!;
  var position = geometry.getAttribute('position');

  _matrixWorldInv.copy(root.matrixWorld).invert();

  for (var i = 0, j = 0; i < bones.length; i++) {
    var bone = bones[i];

    if (bone.parent != null && bone.parent.type == "Bone") {
      _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld);
      _shvector.setFromMatrixPosition(_boneMatrix);
      position.setXYZ(j, _shvector.x, _shvector.y, _shvector.z);

      _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.parent.matrixWorld);
      _shvector.setFromMatrixPosition(_boneMatrix);
      position.setXYZ(j + 1, _shvector.x, _shvector.y, _shvector.z);

      j += 2;
    }
  }

  geometry.getAttribute('position').needsUpdate = true;

  super.updateMatrixWorld(force);
}