Class NavMeshGraph Extends NavmeshBase, IUpdatableGraph

Public

Generates graphs based on navmeshes.

Navmeshes are meshes in which each triangle defines a walkable area. These are great because the AI can get so much more information on how it can walk. Polygons instead of points mean that the FunnelModifier can produce really nice looking paths, and the graphs are also really fast to search and have a low memory footprint because fewer nodes are usually needed to describe the same area compared to grid graphs.

The navmesh graph requires that you create a navmesh manually. The package also has support for generating navmeshes automatically using the RecastGraph.

For a tutorial on how to configure a navmesh graph, take a look at Using navmeshes.

Source Mesh

Mesh to construct navmesh from.

Offset

Offset in world space.

Rotation

Rotation in degrees.

Scale

Scale of the graph.

Recalculate Normals

Determines how normals are calculated.

Affected By Navmesh Cuts

Should navmesh cuts affect this graph.

Initial Penalty

Default penalty to apply to all nodes.

Inner Types

Public Methods

Returns a new transform which transforms graph space to world space.

IsInsideBounds (point)

True if the point is inside the bounding box of this graph.

Public Static Methods

UpdateArea (o, graph)

Public Variables

MaxTileConnectionEdgeDistance

Maximum (vertical) distance between the sides of two nodes for them to be connected across a tile edge.

Public
NavmeshCuttingCharacterRadius
RecalculateNormals

Determines how normals are calculated.

Public
TileWorldSizeX

Size of a tile in world units along the X axis.

Public
TileWorldSizeZ

Size of a tile in world units along the Z axis.

Public
bounds

World bounding box for the graph.

Public
navmeshCuttingCharacterRadius

Radius to use when expanding navmesh cuts.

offset

Offset in world space.

Public
recalculateNormals

Determines how normals are calculated.

Public
rotation

Rotation in degrees.

Public
scale

Scale of the graph.

Public
sourceMesh

Mesh to construct navmesh from.

Public

Inherited Public Members

ClearTiles (tileRect)

Clears the tiles in the specified rectangle.

Number of nodes in the graph.

End batch updating of tiles.

GetNearest (position, [...])

...

GetNodes (action)

Calls a delegate with all nodes in the graph...

GetTile (x, z)

Tile at the specified x, z coordinate pair.

Returns a bounds object with the bounding box of a group of tiles.

Returns an XZ bounds object with the bounds of a group of tiles in graph space.

...

GetTileIndex (index)

Tile index from a vertex index.

All tiles.

GetTouchingTiles (bounds, margin=0)

Returns a rect containing the indices of all tiles touching the specified bounds.

Returns a rect containing the indices of all tiles touching the specified bounds.

GetVertex (index)

Vertex coordinate for the specified vertex index.

Vertex coordinate in graph space for the specified vertex index.

IsPointOnNavmesh (position)

True if the point is on a walkable part of the navmesh, as seen from above.

Linecast (..., end, ...)

Returns if there is an obstacle between...

NearestNodeDistanceSqrLowerBound (position, constraint)

Lower bound on the squared distance from the given point to the closest node in this graph.

OnDrawGizmos (gizmos, drawNodes, redrawScope)

Draw gizmos for the graph.

OnRecalculatedTiles

Called when tiles have been completely recalculated.

Public
PointOnNavmesh (position, constraint)

Finds the first node which contains position.

RandomPointOnSurface (nnConstraint=null, highQuality=true)

A random point on the graph.

Moves the nodes in this graph.

ReplaceTile (x, z, verts, tris, [tags], [tryPreserveExistingTagsAndPenalties])

Replace tile at index with nodes created from specified navmesh.

Scan ()

Scan the graph.

Snapshot (bounds)

Captures a snapshot of a part of the graph, to allow restoring it later.

StartBatchTileUpdate (exclusive=…)

Start batch updating of tiles.

TileIndexMask
Public Static
TileIndexOffset
Public Static
VertexIndexMask
Public Static
active

Reference to the AstarPath object in the scene.

Public
bounds

World bounding box for the graph.

Public
drawGizmos

Enable to draw gizmos in the Unity scene view.

Public
enableNavmeshCutting

Should navmesh cuts affect this graph.

Public
forcedBoundsSize

Size of the bounding box.

Public
graphIndex

Index of the graph, used for identification purposes.

Public
guid

Used as an ID of the graph, considered to be unique.

Public
infoScreenOpen

Used in the editor to check if the info screen is open.

Public
initialPenalty

Default penalty to apply to all nodes.

Public
isScanned

True if the graph has been scanned and contains nodes.

Public
name

Name of the graph.

Public
navmeshUpdateData

Handles navmesh cutting.

open

Is the graph open in the editor.

Public
persistent

True if the graph will be included when serializing graph data.

Public
showInInspector

True if the graph should be visible in the editor.

Public
showMeshOutline

Show an outline of the polygons in the Unity Editor.

Public
showMeshSurface

Show the surface of the navmesh.

Public
showNodeConnections

Show the connections between the polygons in the Unity Editor.

Public
tileXCount

Number of tiles along the X-axis.

Public
tileZCount

Number of tiles along the Z-axis.

Public
transform

Determines how the graph transforms graph space to world space.

Public

Private/Protected Members

Throws an exception if it is not safe to update internal graph data right now.

ClearTile (x, z, replacement)

Clear the tile at the specified coordinate.

ConnectTileWithNeighbours (tile, onlyUnflagged=…)
ConnectTiles (tile1, tile2, tileWorldSizeX, tileWorldSizeZ, maxTileConnectionEdgeDistance)

Generate connections between the two tiles.

CreateNodeConnections (nodes, keepExistingConnections)

Create connections between all nodes.

CreateNodes (tile, tris, tileIndex, graphIndex, tags, initializeNodes, astar, initialPenalty, tryPreserveExistingTagsAndPenalties)

Deserializes graph type specific node data.

Destroys all nodes in the graph.

DirtyBounds (bounds)

Notifies the system that changes have been made inside these bounds.

Cleans up any unmanaged data that the graph has.

DrawUnwalkableNodes (gizmos, size, redrawScope)

Fills graph with tiles created by NewEmptyTile.

NewEmptyTile (x, z)

Creates a single new empty tile.

Function for cleaning up references.

Called after all deserialization has been done for all graphs.

ReplaceTilePostCut (x, z, verts, tris, tags, tryPreserveExistingTagsAndPenalties=true, preservePreCutData=…)
ScanInternal ([...])

Internal method to scan the graph.

ScheduleGraphUpdates (graphUpdates)

Schedules a number of graph updates.

Serializes Node Info.

cachedSourceMeshBoundsMin

Cached bounding box minimum of sourceMesh.

Private
exists

True if the graph exists, false if it has been destroyed.

Internal
tiles

All tiles.

Protected