---
title: "cameraDistance(_:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/levelofdetailcomponent/selectionstrategy/cameradistance(_:)"
---

# cameraDistance(_:)

Switch levels based on distance from the camera.

## Declaration

```swift
static func cameraDistance(_ thresholds: [Float]) -> LevelOfDetailComponent.SelectionStrategy
```

## Discussion

Discussion Each threshold specifies the maximum camera distance for a level. The last threshold is typically .infinity to catch all remaining distances.

## See Also

### Creating a strategy

- [screenArea(_:)](realitykit/levelofdetailcomponent/selectionstrategy/screenarea(_:).md)
