<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLCamera/frameBoundingBox(_:setNearAndFar:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLCamera(im)frameBoundingBox:setNearAndFar:"
  },
  "title" : "frameBoundingBox(_:setNearAndFar:)"
}
-->

# frameBoundingBox(_:setNearAndFar:)

Moves the camera such that the specified bounding box lies entirely within the camera’s field of view.

```
func frameBoundingBox(_ boundingBox: MDLAxisAlignedBoundingBox, setNearAndFar: Bool)
```

## Parameters

`boundingBox`

The region, in world space coordinates, to be made visible to the camera.

`setNearAndFar`

If <doc://com.apple.documentation/documentation/Swift/true>, the camera also adjusts its [`nearVisibilityDistance`](/documentation/ModelIO/MDLCamera/nearVisibilityDistance) and [`farVisibilityDistance`](/documentation/ModelIO/MDLCamera/farVisibilityDistance) properties to place the specified region entirely within the camera’s viewing frustum. If <doc://com.apple.documentation/documentation/Swift/false>, those properties remain unchanged, and the specified region may therefore lie outside the camera’s near and far limits.

## Discussion

When calculating the new camera position and orientation, this method assumes the camera points in the negative z-axis direction and that the positive y-axis represents the up direction for the camera’s view.

---

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)