worldAabb property

Aabb get worldAabb

Computes the AABB of this node AND all its descendants in world space. Group nodes have no geometry, so their own box would be a phantom ±0.5m cube at their position — using it for culling wrongly discarded entire subtrees. The union is cached and invalidated on any transform or hierarchy change in the subtree.

Implementation

Aabb get worldAabb {
  if (_worldAabbDirty || _worldAabbCache == null) {
    final result = ownWorldAabb;
    for (final child in _children) {
      result.expandToIncludeAabb(child.worldAabb);
    }
    _worldAabbCache = result;
    _worldAabbDirty = false;
  }
  return _worldAabbCache!;
}