---
title: "visualBounds(recursive:relativeTo:excludeInactive:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/hastransform/visualbounds(recursive:relativeto:excludeinactive:)"
---

# visualBounds(recursive:relativeTo:excludeInactive:)

Computes a bounding box for the entity in the specified space, optionally including child entities.

## Declaration

```swift
@MainActor @preconcurrency func visualBounds(recursive: Bool = true, relativeTo referenceEntity: Entity?, excludeInactive: Bool = false) -> BoundingBox
```

## Parameters

- `recursive`: A Boolean that you set to true to incorporate the bounds of all descendants.
- `referenceEntity`: An entity that defines a frame of reference. Set to nil to indicate world space.
- `excludeInactive`: A Boolean that you set to true to exclude inactive entities.

## Mentioned in

Controlling the layout behavior of a reality view

## Return Value

Return Value The bounding box.

## Discussion

Discussion The method has complexity O(n), where n is the number of entities in the hierarchy.
