updateWorldMatrix method
updateParents
- recursively updates global transform of ancestors.
updateChildren
- recursively updates global transform of descendants.
Updates the global transform of the object.
Implementation
void updateWorldMatrix(bool updateParents, bool updateChildren) {
final parent = this.parent;
if (updateParents == true && parent != null) {
parent.updateWorldMatrix(true, false);
}
if (matrixAutoUpdate) updateMatrix();
if (this.parent == null) {
matrixWorld.setFrom(matrix);
} else {
matrixWorld.multiply2(this.parent!.matrixWorld, matrix);
}
// update children
if (updateChildren == true) {
final children = this.children;
for (int i = 0, l = children.length; i < l; i++) {
children[i].updateWorldMatrix(false, true);
}
}
}