updateMatrixWorld method

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

force - A boolean that can be used to bypass matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame. Useful if you cannot wait for the renderer to update it on the next frame (assuming matrixWorldAutoUpdate set to true).

Updates the global transform of the object and its descendants if the world matrix needs update (matrixWorldNeedsUpdate set to true) or if the force parameter is set to true.

Implementation

void updateMatrixWorld([bool force = false]) {
  if (matrixAutoUpdate) updateMatrix();

  if (matrixWorldNeedsUpdate || force) {
    if (parent == null) {
      matrixWorld.setFrom(matrix);
    } else {
      matrixWorld.multiply2(parent!.matrixWorld, matrix);
    }

    matrixWorldNeedsUpdate = false;

    force = true;
  }

  // update children

  List<Object3D> children = this.children;

  for (int i = 0, l = children.length; i < l; i++) {
    children[i].updateMatrixWorld(force);
  }
}