---
title: "frameBoundingBox(_:setNearAndFar:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlcamera/frameboundingbox(_:setnearandfar:)"
---

# frameBoundingBox(_:setNearAndFar:)

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

## Declaration

```swift
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 doc://com.apple.modelio/documentation/ModelIO/MDLCamera/nearVisibilityDistance and doc://com.apple.modelio/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

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.

## See Also

### Managing Camera Position and Orientation

- [look(at:)](modelio/mdlcamera/look(at:).md)
- [look(at:from:)](modelio/mdlcamera/look(at:from:).md)
