public sealed class NavMeshThe walkable surface, as convex polygons in tiles that can be added and removed while agents are standing on them.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Everything that answers a question about the mesh — nearest polygon, path, raycast — is in NavMeshQuery, which holds the search state a query needs and which is therefore one per thread. This type is the data, and reading it is thread-safe as long as no tile is being added or removed at the same time.
Tiles are the unit of everything. A bake produces one, streaming loads one, a rebuild after a building is destroyed replaces one. The links across their borders are recomputed from the tiles present, on every add and every remove, rather than stored — a stored link is a thing that can outlive what it points at, and this mesh is expected to have tiles removed underneath live paths.
Fields and properties (5)
public const int MaxVerticesPerPolyThe most vertices a polygon may have. Six is Recast's default and the reason the query layer can put a polygon's vertices on the stack.
public const int NoEdgeWhat a link's edge index is when there is no edge — an off-mesh connection, which joins two polygons at a point rather than along a side.
public NavMeshParams ParamsWhere the tile grid is and how big its tiles are.
public int TileCountHow many tiles are loaded.
public IEnumerable<NavMeshTile> TilesEvery loaded tile, in slot order.
Methods (17)
public NavMesh(NavMeshParams parameters)Creates an empty mesh.
public (int X, int Z) TileCoordinates(Vector3 position)Which tile a world position falls in, whether or not one is loaded there.
public NavMeshTile? TileAt(int x, int z)The tile at a grid position, if one is loaded.
public NavMeshTile AddTile(NavMeshTileData data)Loads a tile, replacing whatever was at its grid position.
public bool RemoveTile(int x, int z)Unloads the tile at a grid position.
public bool TryGetPoly(NavPolyRef reference, out NavMeshTile tile, out int poly)Resolves a reference.
public bool IsValid(NavPolyRef reference)Whether a reference still names a live polygon.
public static NavPolyRef ReferenceOf(NavMeshTile tile, int poly)The reference for a polygon of a loaded tile.
public int GetPolyVertices(NavPolyRef reference, Span<Vector3> destination)Copies a polygon's vertices out.
public bool TryGetDetailHeight(NavPolyRef reference, Vector3 position, out float height)The height of the sampled ground over a point, if the bake sampled any.
public bool TryGetPolyAttributes(NavPolyRef reference, out byte area, out NavPolyFlags flags)A polygon's area id and flags.
public bool SetPolyFlags(NavPolyRef reference, NavPolyFlags flags)Changes a polygon's flags — closing a door, disabling a bridge.
public NavMesh.NeighbourEnumerator Neighbours(NavPolyRef reference)Walks a polygon's neighbours, inside its tile and across its borders.
public bool GetPortalPoints(NavPolyRef from, NavPolyRef to, out Vector3 left, out Vector3 right)The segment two adjacent polygons share, as the two points a funnel puts on its left and right sides.
public bool IsOffMeshConnection(NavPolyRef reference)Whether a polygon is an off-mesh connection rather than a piece of surface.
public bool TryGetOffMeshConnection(NavPolyRef reference, out NavOffMeshConnectionData connection)The connection a polygon is, if it is one.
public bool GetEdgeMidpoint(NavPolyRef from, NavPolyRef to, out Vector3 point)The midpoint of the segment two adjacent polygons share.
Used by (32)
- CrowdBenchmarksVixen.Benchmarks.Navigation
- PathQueueBenchmarksVixen.Benchmarks.Navigation
- QueryBenchmarksVixen.Benchmarks.Navigation
- CrossTileConnectionTestsVixen.Navigation.Tests
- CrowdVixen.Navigation
- CrowdRetargetTestsVixen.Navigation.Tests
- CrowdTestsVixen.Navigation.Tests
- DetailMeshTestsVixen.Navigation.Tests
- HeightfieldTestsVixen.Navigation.Tests
- NavAreaVolumeTestsVixen.Navigation.Tests
- NavMeshAssetVixen.Navigation
- NavMeshAssetTestsVixen.Navigation.Tests
- NavMeshBakeTestsVixen.Navigation.Tests
- NavMeshBuildSettingsVixen.Navigation
- NavMeshDebugDrawVixen.Navigation
- NavMeshDebugDrawTestsVixen.Navigation.Tests
- NavMeshQueryVixen.Navigation
- NavMeshQueryTestsVixen.Navigation.Tests
- NavPathQueueVixen.Navigation
- NavPathQueueJobTestsVixen.Navigation.Tests
- NavPathQueueTestsVixen.Navigation.Tests
- NavTileCacheVixen.Navigation
- NavTileCacheTestsVixen.Navigation.Tests
- NavigationAllocationTestsVixen.Navigation.Tests
- NavigationSystemTestsVixen.Navigation.Tests
- NeighbourEnumeratorVixen.Navigation
- OffMeshConnectionTestsVixen.Navigation.Tests
- PathCorridorVixen.Navigation
- PolyMeshVixen.Navigation
- RegionMergeTestsVixen.Navigation.Tests
- WatershedTestsVixen.Navigation.Tests
- NavMeshImporterTestsVixen.Editor.Assets.Tests