<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/LevelOfDetailComponent/SelectionStrategy/cameraDistance(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation22LevelOfDetailComponentV17SelectionStrategyV14cameraDistanceyAESaySfGFZ"
  },
  "title" : "cameraDistance(_:)"
}
-->

# cameraDistance(_:)

Switch levels based on distance from the camera.

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

## Discussion

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

---

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)