# NavMeshQuery

> Object used for doing navigation operations in a NavMeshWorld.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine.Experimental.AI](/engine/6000.5/script-reference/unityengine/experimental/ai.md)
* **Assembly:** UnityEngine.AIModule
* **Implements:** [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

> **Warning:**
>
> **Deprecated.** The experimental NavMeshQuery struct has been deprecated. Use NavWorld instead.

```csharp
public struct NavMeshQuery : IDisposable
```

## Remarks

NavMeshQuery operations can be executed inside jobs ([IJob](/engine/6000.5/script-reference/unity/jobs/ijob.md), [IJobParallelFor](/engine/6000.5/script-reference/unity/jobs/ijobparallelfor.md)), as opposed to the operations in the [NavMesh](/engine/6000.5/script-reference/unityengine/ai/navmesh.md)-related structures.

To obtain a path between two locations on the NavMesh, you must create a NavMeshQuery with a `pathNodePoolSize` value in the range from 1 to 65,535. After creating a NavMeshQuery, you must call the following methods in this order: `BeginFindPath`, `UpdateFindPath` (can be repeated), `EndFindPath`, `GetPathResult`. These methods store state data within the NavMeshQuery. Other methods can be called in any order since they do not change state data.

All methods throw exceptions if any of their parameters are not valid when executed in the Editor.

**Note:** The intended feature set for NavMeshQuery is not yet fully complete.

## Constructors

| Constructor                                                                                                                                                                         | Description                                                                                                                                                                         |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NavMeshQuery(UnityEngine.Experimental.AI.NavMeshWorld,Unity.Collections.Allocator,System.Int32)](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/ctor.md) | Creates the [NavMeshQuery](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery.md) object and allocates memory to store NavMesh node information, if required. |

## Methods

| Method                                                                                                                             | Description                                                                                                                                                                                                                                                                     |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [BeginFindPath](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/beginfindpath.md)                         | Initiates a pathfinding operation between two locations on the NavMesh.                                                                                                                                                                                                         |
| [CreateLocation](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/createlocation.md)                       | Returns a valid [NavMeshLocation](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshlocation.md) for a position and a polygon provided by the user.                                                                                                            |
| [Dispose](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/dispose.md)                                     | Destroys the NavMeshQuery and deallocates all memory used by it.                                                                                                                                                                                                                |
| [EndFindPath](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/endfindpath.md)                             | Obtains the number of nodes in the path that has been computed during a successful [NavMeshQuery.UpdateFindPath](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/updatefindpath.md) operation.                                                         |
| [GetAgentTypeIdForPolygon](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/getagenttypeidforpolygon.md)   | Returns the identifier of the agent type the NavMesh was baked for or for which the link has been configured.                                                                                                                                                                   |
| [GetEdgesAndNeighbors](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/getedgesandneighbors.md)           | Retrieves the vertices of a given `node` and the [identifiers](/engine/6000.5/script-reference/unityengine/experimental/ai/polygonid.md) of all the navigation nodes to which it connects.                                                                                      |
| [GetPathResult](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/getpathresult.md)                         | Copies into the provided array the list of NavMesh nodes that form the path found by the NavMeshQuery operation.                                                                                                                                                                |
| [GetPolygonType](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/getpolygontype.md)                       | Returns whether the NavMesh node is a polygon or a link.                                                                                                                                                                                                                        |
| [GetPortalPoints](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/getportalpoints.md)                     | Obtains the end points of the line segment common to two adjacent NavMesh nodes.                                                                                                                                                                                                |
| [IsValid](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/isvalid.md)                                     | Returns `true` if the node referenced by the [PolygonId](/engine/6000.5/script-reference/unityengine/experimental/ai/polygonid.md) contained in the [NavMeshLocation](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshlocation.md) is active in the NavMesh. |
| [MapLocation](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/maplocation.md)                             | Finds the closest point and [PolygonId](/engine/6000.5/script-reference/unityengine/experimental/ai/polygonid.md) on the NavMesh for a given world position.                                                                                                                    |
| [MoveLocation](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/movelocation.md)                           | Translates a NavMesh location to another position without losing contact with the surface.                                                                                                                                                                                      |
| [MoveLocations](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/movelocations.md)                         | Translates a series of NavMesh locations to other positions without losing contact with the surface.                                                                                                                                                                            |
| [MoveLocationsInSameAreas](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/movelocationsinsameareas.md)   | Translates a series of NavMesh locations to other positions without losing contact with the surface, given one common area filter for all of them.                                                                                                                              |
| [PolygonLocalToWorldMatrix](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/polygonlocaltoworldmatrix.md) | Returns the transformation matrix of the NavMesh surface that contains the specified NavMesh node.                                                                                                                                                                              |
| [PolygonWorldToLocalMatrix](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/polygonworldtolocalmatrix.md) | Returns the inverse transformation matrix of the NavMesh surface that contains the specified NavMesh node.                                                                                                                                                                      |
| [Raycast](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/raycast.md)                                     | Trace a line between two points on the NavMesh, and return the list of polygons through which it passed.                                                                                                                                                                        |
| [UpdateFindPath](/engine/6000.5/script-reference/unityengine/experimental/ai/navmeshquery/updatefindpath.md)                       | Continues a path search that is in progress.                                                                                                                                                                                                                                    |
