ModelBoundsUtility

Resolves a ModelComponent's bounds. Bounds are baked at import time in local (model) space only — never cached in world space at runtime — so anything that needs a node's on-screen extent, such as headless scene reporting or viewport picking, transforms them itself.

Public Methods

ComputeLocalBounds

public static Bounds ComputeLocalBounds(ModelComponent component, bool loadModels, bool isResolved)

Resolves a model component's bounds in its own local space.

Parameters:

  • component (ModelComponent): The component to measure.
  • loadModels (bool): Whether to resolve ModelInstance when the component references a whole model rather than a single mesh. Loading a model uploads its GPU resources, so callers that only need a mesh's precomputed bounds can pass false to skip that.
  • isResolved (bool): true when the component's reference resolved to bounds (even if those bounds are empty because loadModels was false); false when the reference is missing or could not be loaded.

Returns: Bounds

  • The component's local-space bounds, or Empty if unresolved.

ToWorldBounds

public static Bounds ToWorldBounds(Bounds local, Matrix4x4 transform)

Transforms local-space bounds into world space by transforming all eight corners and re-encapsulating — cheaper alternatives (transforming just the centre and extents) do not hold once rotation is involved.

Parameters:

  • local (Bounds): Bounds in the source space.
  • transform (Matrix4x4): The transform from that space into world space.

Returns: Bounds