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.

Public Methods

CalculateTransform ()

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

Public
IsInsideBounds (point)

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

Public

Public Static Methods

UpdateArea (o, graph)
Public Static

Public Variables

RecalculateNormals
Public
TileWorldSizeX
Public
TileWorldSizeZ
Public
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

CountNodes ()

Number of nodes in the graph.

Public
EndBatchTileUpdate ()

End batch updating of tiles.

Public
GetNearest (position)

Returns the nearest node to a position.

Public
GetNearest (position, constraint)

Returns the nearest node to a position using the specified NNConstraint.

Public
GetNearest (position, constraint, hint)

Returns the nearest node to a position using the specified NNConstraint.

Public
GetNearestForce (position, constraint)

Returns the nearest node to a position using the specified constraint .

Public
GetNodes (action)

Calls a delegate with all nodes in the graph until the delegate returns false.

Public
GetNodes (action)

Calls a delegate with all nodes in the graph.

Public
GetTile (x, z)

Tile at the specified x, z coordinate pair.

Public
GetTileBounds (rect)

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

Public
GetTileBounds (x, z, width=1, depth=1)

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

Public
GetTileBoundsInGraphSpace (rect)
Public
GetTileBoundsInGraphSpace (x, z, width=1, depth=1)

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

Public
GetTileCoordinates (tileIndex, x, z)

Tile coordinates from a tile index.

Public
GetTileCoordinates (position)

Returns the tile coordinate which contains the specified position.

Public
GetTileIndex (index)

Tile index from a vertex index.

Public Static
GetTiles ()

All tiles.

Public
GetTouchingTiles (bounds, margin=0)

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

Public
GetTouchingTilesInGraphSpace (rect)

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

Public
GetTouchingTilesRound (bounds)

Returns a rect containing the indices of all tiles by rounding the specified bounds to tile borders.

Public
GetVertex (index)

Vertex coordinate for the specified vertex index.

Public
GetVertexArrayIndex (index)
Public
GetVertexInGraphSpace (index)

Vertex coordinate in graph space for the specified vertex index.

Public
Linecast (origin, end)

Returns if there is an obstacle between origin and end on the graph.

Public
Linecast (origin, end, hint, hit)

Returns if there is an obstacle between origin and end on the graph.

Public
Linecast (origin, end, hint)

Returns if there is an obstacle between origin and end on the graph.

Public
Linecast (origin, end, hint, hit, trace)

Returns if there is an obstacle between origin and end on the graph.

Public
Linecast (origin, end, hit, trace, filter)

Returns if there is an obstacle between origin and end on the graph.

Public
Linecast (graph, origin, end, hint, hit)

Returns if there is an obstacle between origin and end on the graph.

Public Static
Linecast (graph, origin, end, hint, hit, trace, filter=null)

Returns if there is an obstacle between origin and end on the graph.

Public Static
OnDrawGizmos (gizmos, drawNodes)

Draw gizmos for the graph.

Public
OnDrawGizmos (gizmos, drawNodes)
Public
OnRecalculatedTiles

Called when tiles have been completely recalculated.

Public
PointOnNavmesh (position, constraint)

Finds the first node which contains position.

Public
RelocateNodes (deltaMatrix)

Moves the nodes in this graph.

Public
RelocateNodes (newTransform)

Moves the nodes in this graph.

Public
ReplaceTile (x, z, verts, tris)

Replace tile at index with nodes created from specified navmesh.

Public
Scan ()

Scan the graph.

Public
StartBatchTileUpdate ()

Start batch updating of tiles.

Public
TileIndexMask
Public Static
TileIndexOffset
Public Static
VertexIndexMask
Public Static
active

Reference to the AstarPath object in the scene.

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
Public
name

Name of the graph.

Public
nearestSearchOnlyXZ

Perform nearest node searches in XZ space only.

Public
open

Is the graph open 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

AssertSafeToUpdateGraph ()

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

Protected
CanUpdateAsync (o)
Private
ClearTile (x, z)

Clear the tile at the specified coordinate.

Protected
ConnectTileWithNeighbours (tile, onlyUnflagged=…)
Protected
ConnectTiles (tile1, tile2)

Generate connections between the two tiles.

Protected
CreateNodeConnections (nodes)

Create connections between all nodes.

Protected Static
CreateNodes (buffer, tris, tileIndex, graphIndex)
Protected
DeserializeExtraInfo (ctx)

Deserializes graph type specific node data.

Protected
DestroyAllNodes ()

Destroys all nodes in the graph.

Protected
DrawUnwalkableNodes (size)
Protected
FillWithEmptyTiles ()

Fills graph with tiles created by NewEmptyTile.

Protected
MaxTileConnectionEdgeDistance
Protected
NewEmptyTile (x, z)

Creates a single new empty tile.

Protected
OnDestroy ()

Function for cleaning up references.

Protected
PostDeserialization (ctx)

Called after all deserialization has been done for all graphs.

Protected
RemoveConnectionsFromTile (tile)
Protected
RemoveConnectionsFromTo (a, b)
Protected
ScanInternal ()

Internal method to scan the graph.

Protected
SerializeExtraInfo (ctx)

Serializes Node Info.

Protected
UpdateArea (o)

Updates an area using the specified #GraphUpdateObject.

Private
UpdateAreaInit (o)

May be called on the Unity thread before starting the update.

Private
UpdateAreaPost (o)

May be called on the Unity thread after executing the update.

Private
cachedSourceMeshBoundsMin

Cached bounding box minimum of sourceMesh.

Private
exists

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

Internal
navmeshUpdateData

Handles navmesh cutting.

tiles

All tiles.

Protected

Deprecated Members

DeserializeSettingsCompatibility (ctx)

An old format for serializing settings.

Protected