Generates graphs based on navmeshes.
Navmeshes are meshes where 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 funnel smoother 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.
- See also
- Pathfinding.RecastGraph
|
override GraphTransform | CalculateTransform () |
| Returns a new transform which transforms graph space to world space. More...
|
|
void | ScanInternal (string objMeshPath) |
| Scans the graph using the path to an .obj mesh. More...
|
|
void | EndBatchTileUpdate () |
| End batch updating of tiles. More...
|
|
override NNInfoInternal | GetNearest (Vector3 position, NNConstraint constraint, GraphNode hint) |
| Returns the nearest node to a position using the specified NNConstraint. More...
|
|
override NNInfoInternal | GetNearestForce (Vector3 position, NNConstraint constraint) |
| Returns the nearest node to a position using the specified constraint . More...
|
|
override void | GetNodes (System.Action< GraphNode > action) |
| Calls a delegate with all nodes in the graph. More...
|
|
NavmeshTile | GetTile (int x, int z) |
| Tile at the specified x, z coordinate pair. More...
|
|
Bounds | GetTileBounds (IntRect rect) |
| Returns an XZ bounds object with the bounds of a group of tiles. More...
|
|
Bounds | GetTileBounds (int x, int z, int width=1, int depth=1) |
| Returns an XZ bounds object with the bounds of a group of tiles. More...
|
|
Bounds | GetTileBoundsInGraphSpace (IntRect rect) |
|
Bounds | GetTileBoundsInGraphSpace (int x, int z, int width=1, int depth=1) |
| Returns an XZ bounds object with the bounds of a group of tiles in graph space. More...
|
|
void | GetTileCoordinates (int tileIndex, out int x, out int z) |
| Tile coordinates from a tile index. More...
|
|
Int2 | GetTileCoordinates (Vector3 position) |
| Returns the tile coordinate which contains the specified position. More...
|
|
NavmeshTile [] | GetTiles () |
| All tiles. More...
|
|
IntRect | GetTouchingTiles (Bounds bounds) |
| Returns a rect containing the indices of all tiles touching the specified bounds. More...
|
|
IntRect | GetTouchingTilesInGraphSpace (Rect rect) |
| Returns a rect containing the indices of all tiles touching the specified bounds. More...
|
|
IntRect | GetTouchingTilesRound (Bounds bounds) |
| Returns a rect containing the indices of all tiles by rounding the specified bounds to tile borders. More...
|
|
Int3 | GetVertex (int index) |
| Vertex coordinate for the specified vertex index. More...
|
|
int | GetVertexArrayIndex (int index) |
|
Int3 | GetVertexInGraphSpace (int index) |
| Vertex coordinate in graph space for the specified vertex index. More...
|
|
bool | Linecast (Vector3 origin, Vector3 end) |
| Returns if there is an obstacle between origin and end on the graph. More...
|
|
bool | Linecast (Vector3 origin, Vector3 end, GraphNode hint, out GraphHitInfo hit) |
| Returns if there is an obstacle between origin and end on the graph. More...
|
|
bool | Linecast (Vector3 origin, Vector3 end, GraphNode hint) |
| Returns if there is an obstacle between origin and end on the graph. More...
|
|
bool | Linecast (Vector3 origin, Vector3 end, GraphNode hint, out GraphHitInfo hit, List< GraphNode > trace) |
| Returns if there is an obstacle between origin and end on the graph. More...
|
|
override void | OnDrawGizmos (Pathfinding.Util.RetainedGizmos gizmos, bool drawNodes) |
|
GraphNode | PointOnNavmesh (Vector3 position, NNConstraint constraint) |
| Finds the first node which contains position. More...
|
|
override void | RelocateNodes (Matrix4x4 deltaMatrix) |
| Moves the nodes in this graph. More...
|
|
void | RelocateNodes (GraphTransform newTransform) |
| Moves the nodes in this graph. More...
|
|
void | ReplaceTile (int x, int z, Int3[] verts, int[] tris) |
| Replace tile at index with nodes created from specified navmesh. More...
|
|
void | ReplaceTile (int x, int z, int w, int d, Int3[] verts, int[] tris) |
| Replaces a tile with a new mesh. More...
|
|
void | StartBatchTileUpdate () |
| Start batch updating of tiles. More...
|
|
virtual int | CountNodes () |
| Number of nodes in the graph. More...
|
|
NNInfoInternal | GetNearest (Vector3 position) |
| Returns the nearest node to a position using the default NNConstraint. More...
|
|
NNInfoInternal | GetNearest (Vector3 position, NNConstraint constraint) |
| Returns the nearest node to a position using the specified NNConstraint. More...
|
|
void | GetNodes (System.Func< GraphNode, bool > action) |
| Calls a delegate with all nodes in the graph until the delegate returns false. More...
|
|
virtual void | OnDrawGizmos (RetainedGizmos gizmos, bool drawNodes) |
| Draw gizmos for the graph. More...
|
|
void | RelocateNodes (Matrix4x4 oldMatrix, Matrix4x4 newMatrix) |
| Moves nodes in this graph. More...
|
|
void | Scan () |
| Scan the graph. More...
|
|
void | ScanGraph () |
| Scan the graph. More...
|
|
void | SetMatrix (Matrix4x4 m) |
| Use to set both matrix and inverseMatrix at the same time. More...
|
|
|
override void | DeserializeSettingsCompatibility (GraphSerializationContext ctx) |
| An old format for serializing settings. More...
|
|
override IEnumerable< Progress > | ScanInternal () |
| Internal method to scan the graph. More...
|
|
void | ClearTiles (int x, int z, int w, int d) |
| Clear all tiles within the rectangle with one corner at (x,z), width w and depth d. More...
|
|
void | ConnectTiles (NavmeshTile tile1, NavmeshTile tile2) |
| Generate connections between the two tiles. More...
|
|
void | ConnectTileWithNeighbours (NavmeshTile tile, bool onlyUnflagged=false) |
|
TriangleMeshNode [] | CreateNodes (int[] tris, int tileIndex, uint graphIndex) |
|
override void | DeserializeExtraInfo (GraphSerializationContext ctx) |
| Deserializes graph type specific node data. More...
|
|
void | FillWithEmptyTiles () |
| Fills graph with tiles created by NewEmptyTile. More...
|
|
NavmeshTile | NewEmptyTile (int x, int z) |
| Creates a single new empty tile. More...
|
|
override void | OnDestroy () |
| Function for cleaning up references. More...
|
|
override void | PostDeserialization (GraphSerializationContext ctx) |
| Called after all deserialization has been done for all graphs. More...
|
|
void | RemoveConnectionsFromTile (NavmeshTile tile) |
|
void | RemoveConnectionsFromTo (NavmeshTile a, NavmeshTile b) |
|
override void | SerializeExtraInfo (GraphSerializationContext ctx) |
| Serializes Node Info. More...
|
|
virtual void | DestroyAllNodes () |
| Destroys all nodes in the graph. More...
|
|
void | DrawUnwalkableNodes (float size) |
|
bool recalculateNormals = true |
Determines how normals are calculated.
Disable for spherical graphs or other complicated surfaces that allow the agents to e.g walk on walls or ceilings.
By default the normals of the mesh will be flipped so that they point as much as possible in the upwards direction. The normals are important when connecting adjacent nodes. Two adjacent nodes will only be connected if they are oriented the same way. This is particularly important if you have a navmesh on the walls or even on the ceiling of a room. Or if you are trying to make a spherical navmesh. If you do one of those things then you should set disable this setting and make sure the normals in your source mesh are properly set.
If you for example take a look at the image below. In the upper case then the nodes on the bottom half of the mesh haven't been connected with the nodes on the upper half because the normals on the lower half will have been modified to point inwards (as that is the direction that makes them face upwards the most) while the normals on the upper half point outwards. This causes the nodes to not connect properly along the seam. When this option is set to false instead the nodes are connected properly as in the original mesh all normals point outwards.
The default value of this field is true to reduce the risk for errors in the common case. If a mesh is supplied that has all normals pointing downwards and this option is false, then some methods like PointOnNavmesh will not work correctly as they assume that the normals point upwards. For a more complicated surface like a spherical graph those methods make no sense anyway as there is no clear definition of what it means to be "inside" a triangle when there is no clear up direction.