<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/HasTransform/visualBounds(recursive:relativeTo:excludeInactive:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation12HasTransformPAAE12visualBounds9recursive10relativeTo15excludeInactiveAA11BoundingBoxVSb_AA6EntityCSgSbtF"
  },
  "title" : "visualBounds(recursive:relativeTo:excludeInactive:)"
}
-->

# visualBounds(recursive:relativeTo:excludeInactive:)

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

```
@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.

## Return Value

The bounding box.

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)