A* Pathfinding Project
4.1.17
The A* Pathfinding Project for Unity 3D
|
Contains utility methods for getting useful information out of graph. More...
Contains utility methods for getting useful information out of graph.
This class works a lot with the Pathfinding.GraphNode class, a useful function to get nodes is AstarPath.GetNearest.
Static Public Member Functions | |
static List< Vector3 > | GetContours (NavGraph graph) |
Convenience method to get a list of all segments of the contours of a graph. More... | |
static void | GetContours (INavmesh navmesh, System.Action< List< Int3 >, bool > results) |
Traces the contour of a navmesh. More... | |
static void | GetContours (GridGraph grid, System.Action< Vector3[]> callback, float yMergeThreshold, GridNodeBase[] nodes=null) |
Finds all contours of a collection of nodes in a grid graph. More... | |
|
static |
Convenience method to get a list of all segments of the contours of a graph.
This method works for navmesh, recast, grid graphs and layered grid graphs. For other graph types it will return an empty list.
If you need more information about how the contours are connected you can take a look at the other variants of this method.
Traces the contour of a navmesh.
navmesh | The navmesh-like object to trace. This can be a recast or navmesh graph or it could be a single tile in one such graph. |
results | Will be called once for each contour with the contour as a parameter as well as a boolean indicating if the contour is a cycle or a chain (see second image). |
This image is just used to illustrate the difference between chains and cycles. That it shows a grid graph is not relevant.
|
static |
Finds all contours of a collection of nodes in a grid graph.
grid | The grid to find the contours of |
callback | The callback will be called once for every contour that is found with the vertices of the contour. The contour always forms a cycle. |
yMergeThreshold | Contours will be simplified if the y coordinates for adjacent vertices differ by no more than this value. |
nodes | Only these nodes will be searched. If this parameter is null then all nodes in the grid graph will be searched. |
In the image below you can see the contour of a graph.
In the image below you can see the contour of just a part of a grid graph (when the nodes parameter is supplied)
Contour of a hexagon graph