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

# NavigationMeshResource

A representation of a scene’s navigable surfaces that the system uses to compute paths.

```
class NavigationMeshResource
```

## Overview

Build a navigation mesh from a model’s geometry or from raw vertex and polygon
data, then mark areas and flags to describe where agents can travel and at what
cost. Provide the resulting resource to a [`NavigationMeshComponent`](/documentation/RealityKit/NavigationMeshComponent) so a
[`NavigationController`](/documentation/RealityKit/NavigationController) can find paths across it.

## Topics

### Creating a navigation mesh

[`convenience init(mesh: MeshResource, offMeshConnections: [NavigationMeshResource.OffMeshConnection], configuration: NavigationMeshResource.Configuration) throws`](/documentation/RealityKit/NavigationMeshResource/init(mesh:offMeshConnections:configuration:)-6xdta)

Creates a NavigationMeshResource from a MeshResource.
This will take the input geometry and configuration and process it into a Navigation Mesh. The input and final geometry of the Navigation Mesh may not match, as it strives to simplify regions and match the configuration to determine what areas are walkable.

[`convenience init(mesh: MeshResource, offMeshConnections: [NavigationMeshResource.OffMeshConnection], configuration: NavigationMeshResource.Configuration) async throws`](/documentation/RealityKit/NavigationMeshResource/init(mesh:offMeshConnections:configuration:)-7mj9i)

Asynchronously creates a NavigationMeshResource from a MeshResource.
This will take the input geometry and configuration and process it into a Navigation Mesh. The input and final geometry of the Navigation Mesh may not match, as it strives to simplify regions and match the configuration to determine what areas are walkable.

[`convenience init(meshDescriptor: MeshDescriptor, offMeshConnections: [NavigationMeshResource.OffMeshConnection], configuration: NavigationMeshResource.Configuration) throws`](/documentation/RealityKit/NavigationMeshResource/init(meshDescriptor:offMeshConnections:configuration:)-3n43t)

Creates a NavigationMeshResource from a MeshDescriptor.
This will take the input geometry and configuration and process it into a Navigation Mesh. The input and final geometry of the Navigation Mesh may not match, as it strives to simplify regions and match the configuration to determine what areas are walkable.

[`convenience init(meshDescriptor: MeshDescriptor, offMeshConnections: [NavigationMeshResource.OffMeshConnection], configuration: NavigationMeshResource.Configuration) async throws`](/documentation/RealityKit/NavigationMeshResource/init(meshDescriptor:offMeshConnections:configuration:)-6zzvf)

Asynchronously creates a NavigationMeshResource from a MeshDescriptor.
This will take the input geometry and configuration and process it into a Navigation Mesh. The input and final geometry of the Navigation Mesh may not match, as it strives to simplify regions and match the configuration to determine what areas are walkable.

[`init(triangleIndices: [UInt32], vertices: [SIMD3<Float>], offMeshConnections: [NavigationMeshResource.OffMeshConnection], configuration: NavigationMeshResource.Configuration) throws`](/documentation/RealityKit/NavigationMeshResource/init(triangleIndices:vertices:offMeshConnections:configuration:)-2rrq1)

Creates a NavigationMeshResource from triangle indices and vertices.
This will take the input geometry and configuration and process it into a Navigation Mesh. The input and final geometry of the Navigation Mesh may not match, as it strives to simplify regions and match the configuration to determine what areas are walkable.

[`convenience init(triangleIndices: [UInt32], vertices: [SIMD3<Float>], offMeshConnections: [NavigationMeshResource.OffMeshConnection], configuration: NavigationMeshResource.Configuration) async throws`](/documentation/RealityKit/NavigationMeshResource/init(triangleIndices:vertices:offMeshConnections:configuration:)-480i3)

Asynchronously creates a NavigationMeshResource from triangle indices and vertices.
This will take the input geometry and configuration and process it into a Navigation Mesh. The input and final geometry of the Navigation Mesh may not match, as it strives to simplify regions and match the configuration to determine what areas are walkable.

[`convenience init(polygonIndices: [[Int]], vertices: [SIMD3<Float>], offMeshConnections: [NavigationMeshResource.OffMeshConnection], configuration: NavigationMeshResource.Configuration, areas: [NavigationMeshResource.Area], flags: [[NavigationMeshResource.Flag]], heightData: NavigationMeshResource.HeightData) throws`](/documentation/RealityKit/NavigationMeshResource/init(polygonIndices:vertices:offMeshConnections:configuration:areas:flags:heightData:))

Creates a NavigationMeshResource through existing Navigation Mesh data.
This will not regenerate the Navigation Mesh. It will copy and save the input data to create a Navigation Mesh with this information.

### Marking areas and flags

[`func markAreaInBox(boundingBox: BoundingBox, area: NavigationMeshResource.Area)`](/documentation/RealityKit/NavigationMeshResource/markAreaInBox(boundingBox:area:))

Marks all polygons in this box with an area.

[`func markFlagInBox(boundingBox: BoundingBox, flag: NavigationMeshResource.Flag)`](/documentation/RealityKit/NavigationMeshResource/markFlagInBox(boundingBox:flag:))

Marks all polygons in this box with a flag.

[`func markAreaInCylinder(position: SIMD3<Float>, radius: Float, halfHeight: Float, area: NavigationMeshResource.Area)`](/documentation/RealityKit/NavigationMeshResource/markAreaInCylinder(position:radius:halfHeight:area:))

Marks all polygons in this cylinder with an area.

[`func markFlagInCylinder(position: SIMD3<Float>, radius: Float, halfHeight: Float, flag: NavigationMeshResource.Flag)`](/documentation/RealityKit/NavigationMeshResource/markFlagInCylinder(position:radius:halfHeight:flag:))

Marks all polygons in this cylinder with a flag.

[`func markAreaOnPolygons(polygonIndices: [Int], area: NavigationMeshResource.Area)`](/documentation/RealityKit/NavigationMeshResource/markAreaOnPolygons(polygonIndices:area:))

Marks the polygons at these indices with an area.

[`func markFlagOnPolygons(polygonIndices: [Int], flag: NavigationMeshResource.Flag)`](/documentation/RealityKit/NavigationMeshResource/markFlagOnPolygons(polygonIndices:flag:))

Marks the polygons at these indices with a flag.

[`func markAreaOnOffMeshConnections(offMeshConnectionIndices: [Int], area: NavigationMeshResource.Area)`](/documentation/RealityKit/NavigationMeshResource/markAreaOnOffMeshConnections(offMeshConnectionIndices:area:))

Marks the off-mesh connections at these indices with an area.

[`func markFlagOnOffMeshConnections(offMeshConnectionIndices: [Int], flag: NavigationMeshResource.Flag)`](/documentation/RealityKit/NavigationMeshResource/markFlagOnOffMeshConnections(offMeshConnectionIndices:flag:))

Marks the off-mesh connections at these indices with a flag.

### Removing areas and flags

[`func removeAreaInBox(boundingBox: BoundingBox, area: NavigationMeshResource.Area)`](/documentation/RealityKit/NavigationMeshResource/removeAreaInBox(boundingBox:area:))

Removes the area from all polygons in this box.

[`func removeFlagInBox(boundingBox: BoundingBox, flag: NavigationMeshResource.Flag)`](/documentation/RealityKit/NavigationMeshResource/removeFlagInBox(boundingBox:flag:))

Removes the flag from all polygons in this box.

[`func removeAreaInCylinder(position: SIMD3<Float>, radius: Float, halfHeight: Float, area: NavigationMeshResource.Area)`](/documentation/RealityKit/NavigationMeshResource/removeAreaInCylinder(position:radius:halfHeight:area:))

Removes the area from all polygons in this cylinder.

[`func removeFlagInCylinder(position: SIMD3<Float>, radius: Float, halfHeight: Float, flag: NavigationMeshResource.Flag)`](/documentation/RealityKit/NavigationMeshResource/removeFlagInCylinder(position:radius:halfHeight:flag:))

Removes the flag from all polygons in this cylinder.

[`func removeAreaOnPolygons(polygonIndices: [Int], area: NavigationMeshResource.Area)`](/documentation/RealityKit/NavigationMeshResource/removeAreaOnPolygons(polygonIndices:area:))

Removes the area from the polygons at these indices.

[`func removeFlagOnPolygons(polygonIndices: [Int], flag: NavigationMeshResource.Flag)`](/documentation/RealityKit/NavigationMeshResource/removeFlagOnPolygons(polygonIndices:flag:))

Removes the flag from the polygons at these indices.

[`func removeAreaOnOffMeshConnections(offMeshConnectionIndices: [Int], area: NavigationMeshResource.Area)`](/documentation/RealityKit/NavigationMeshResource/removeAreaOnOffMeshConnections(offMeshConnectionIndices:area:))

Removes the area from the off-mesh connections at these indices.

[`func removeFlagOnOffMeshConnections(offMeshConnectionIndices: [Int], flag: NavigationMeshResource.Flag)`](/documentation/RealityKit/NavigationMeshResource/removeFlagOnOffMeshConnections(offMeshConnectionIndices:flag:))

Removes the flag from the off-mesh connections at these indices.

### Accessing mesh data

[`var vertices: [SIMD3<Float>]`](/documentation/RealityKit/NavigationMeshResource/vertices)

The vertices of the generated Navigation Mesh.

[`var polygonIndices: [[Int]]`](/documentation/RealityKit/NavigationMeshResource/polygonIndices)

The polygon indices of the generated Navigation Mesh. Polygons may have different numbers of vertices, so each entry in the list is a list of indices into the vertices array for that polygon.

[`var areas: [NavigationMeshResource.Area]`](/documentation/RealityKit/NavigationMeshResource/areas)

The areas associated with each polygon in the generated Navigation Mesh.

[`var flags: [[NavigationMeshResource.Flag]]`](/documentation/RealityKit/NavigationMeshResource/flags)

The flags associated with each polygon in the generated Navigation Mesh.

[`var offMeshConnections: [NavigationMeshResource.OffMeshConnection]`](/documentation/RealityKit/NavigationMeshResource/offMeshConnections)

The off-mesh connections of the generated Navigation Mesh.

[`var heightData: NavigationMeshResource.HeightData`](/documentation/RealityKit/NavigationMeshResource/heightData-swift.property)

The detailed height data of the generated Navigation Mesh.

[`var layer: NavigationMeshResource.Layer?`](/documentation/RealityKit/NavigationMeshResource/layer-swift.property)

The identification of this NavigationMeshResource, used when entities are searching for a specific NavigationMeshResource in a scene.

[`var configuration: NavigationMeshResource.Configuration`](/documentation/RealityKit/NavigationMeshResource/configuration-swift.property)

The configuration this Navigation Mesh was created with.

### Supporting types

[`struct Configuration`](/documentation/RealityKit/NavigationMeshResource/Configuration-swift.struct)

The NavigationMeshResource configuration that defines how the mesh is created.

[`struct Area`](/documentation/RealityKit/NavigationMeshResource/Area)

An identifier for different areas on a Navigation Mesh.

[`struct Flag`](/documentation/RealityKit/NavigationMeshResource/Flag)

An identifier for different flags on a Navigation Mesh.

[`struct FlagGroup`](/documentation/RealityKit/NavigationMeshResource/FlagGroup)

A collection of Flags.

[`struct OffMeshConnection`](/documentation/RealityKit/NavigationMeshResource/OffMeshConnection)

A container for the data associated with an off-mesh connection.

[`struct HeightData`](/documentation/RealityKit/NavigationMeshResource/HeightData-swift.struct)

A container for the detailed height data of the NavigationMeshResource.

[`struct Layer`](/documentation/RealityKit/NavigationMeshResource/Layer-swift.struct)

An identifier for a Navigation Mesh, used by a [`NavigationComponent`](/documentation/RealityKit/NavigationComponent) to select a specific Navigation Mesh for pathfinding.

[`struct PathNode`](/documentation/RealityKit/NavigationMeshResource/PathNode)

A container for the path node data.

### Initializers

[`convenience(mesh:offMeshConnections:configuration:)`](/documentation/RealityKit/NavigationMeshResource/init(mesh:offMeshConnections:configuration:))

Asynchronously creates a NavigationMeshResource from a MeshResource.
This will take the input geometry and configuration and process it into a Navigation Mesh. The input and final geometry of the Navigation Mesh may not match, as it strives to simplify regions and match the configuration to determine what areas are walkable.

[`convenience(meshDescriptor:offMeshConnections:configuration:)`](/documentation/RealityKit/NavigationMeshResource/init(meshDescriptor:offMeshConnections:configuration:))

Asynchronously creates a NavigationMeshResource from a MeshDescriptor.
This will take the input geometry and configuration and process it into a Navigation Mesh. The input and final geometry of the Navigation Mesh may not match, as it strives to simplify regions and match the configuration to determine what areas are walkable.

[`convenience(named:in:)`](/documentation/RealityKit/NavigationMeshResource/init(named:in:))

Asynchronously creates a NavigationMeshResource by importing an existing one from a Bundle.
The name is the path of the NavigationMeshResource within the bundle.
The bundle is the app package that contains the NavigationMeshResource. If nothing is specified, then the main bundle is used.
This loads an existing Navigation Mesh and will not process and create a new one.

[`convenience(triangleIndices:vertices:offMeshConnections:configuration:)`](/documentation/RealityKit/NavigationMeshResource/init(triangleIndices:vertices:offMeshConnections:configuration:))

Asynchronously creates a NavigationMeshResource from triangle indices and vertices.
This will take the input geometry and configuration and process it into a Navigation Mesh. The input and final geometry of the Navigation Mesh may not match, as it strives to simplify regions and match the configuration to determine what areas are walkable.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Resource`](/documentation/RealityKit/Resource)

[`Sendable`](/documentation/Swift/Sendable)

---

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)