worldTransformMatrix property

Matrix4 get worldTransformMatrix

The world-space transformation matrix, accounting for all ancestor Component3Ds.

The result is cached and only recomputed when this component's or an ancestor's transform changes.

Implementation

Matrix4 get worldTransformMatrix {
  if (!_worldTransformDirty) {
    return _worldTransformMatrix;
  }
  _worldTransformDirty = false;

  final p = parent;
  if (p is Component3D) {
    return _worldTransformMatrix
      ..setFrom(p.worldTransformMatrix)
      ..multiply(transformMatrix);
  }
  return _worldTransformMatrix..setFrom(transformMatrix);
}