<!--
{
  "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/NavigationController",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation20NavigationControllerV"
  },
  "title" : "NavigationController"
}
-->

# NavigationController

An interface for finding paths for an entity moving across a scene’s navigation mesh.

```
struct NavigationController
```

## Overview

Create a navigation controller for an entity, then call
[`requestPath(to:)`](/documentation/RealityKit/NavigationController/requestPath(to:)) to start an asynchronous pathfind or
[`computePath(to:)`](/documentation/RealityKit/NavigationController/computePath(to:)) to compute a path immediately. Track
[`pathfindStatus`](/documentation/RealityKit/NavigationController/pathfindStatus-swift.property) and read
[`currentPath`](/documentation/RealityKit/NavigationController/currentPath) to follow the result.

## Topics

### Creating a navigation controller

[`init(entity: Entity) throws`](/documentation/RealityKit/NavigationController/init(entity:))

Creates a NavigationController from an Entity with a NavigationComponent.

### Requesting pathfinding

[`func requestPath(to: SIMD3<Float>)`](/documentation/RealityKit/NavigationController/requestPath(to:))

Requests a pathfind from the owning entity’s position to the target position.

[`func requestPath(from: SIMD3<Float>, to: SIMD3<Float>)`](/documentation/RealityKit/NavigationController/requestPath(from:to:))

Requests a pathfind from a given position to the target position.

[`func stopPathfind()`](/documentation/RealityKit/NavigationController/stopPathfind())

Cancels any in-progress pathfinds.

### Computing paths

[`func computePath(to: SIMD3<Float>) async -> [NavigationMeshResource.PathNode]?`](/documentation/RealityKit/NavigationController/computePath(to:))

Asynchronously requests a pathfind from the owning entity’s position to the target position and waits for the path or a failure.
If the function returns an empty path, the pathfind succeeded with no nodes (for example, the start and end positions are in the same place).
If the function returns nil, the pathfinding failed to find a path.

[`func computePath(from: SIMD3<Float>, to: SIMD3<Float>) async -> [NavigationMeshResource.PathNode]?`](/documentation/RealityKit/NavigationController/computePath(from:to:))

Asynchronously requests a pathfind from a given position to the target position and waits for the path or a failure.
If the function returns an empty path, the pathfind succeeded with no nodes (for example, the start and end positions are in the same place).
If the function returns nil, the pathfinding failed to find a path.

### Monitoring pathfinding status

[`var pathfindStatus: NavigationController.PathfindStatus`](/documentation/RealityKit/NavigationController/pathfindStatus-swift.property)

The current pathfind status.

[`enum PathfindStatus`](/documentation/RealityKit/NavigationController/PathfindStatus-swift.enum)

The status of a pathfinding request.

[`var currentPath: [NavigationMeshResource.PathNode]`](/documentation/RealityKit/NavigationController/currentPath)

The computed path to the target position found by requestPath(). If called before the pathfind completes,
a partial path will be returned. This partial path may be suboptimal.
If the pathfind failed or was not requested, the function will return an empty array.



---

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)