A* Pathfinding Project
3.1.4
The A* Pathfinding Project for Unity 3D
|
Contains useful functions for working with paths and nodes. More...
Static Public Member Functions | |
static List< Node > | GetReachableNodes (Node seed, int tagMask=-1) |
Returns all nodes reachable from the seed node. | |
static bool | IsPathPossible (Node n1, Node n2) |
Returns if there is a walkable path from n1 to n2. | |
static bool | IsPathPossible (List< Node > nodes) |
Returns if there are walkable paths between all nodes. | |
Contains useful functions for working with paths and nodes.
This class works a lot with the Node class, a useful function to get nodes is AstarPath.GetNearest.
Returns all nodes reachable from the seed node.
This function performs a BFS (breadth-first-search) or flood fill of the graph and returns all nodes which can be reached from the seed node. In almost all cases this will be identical to returning all nodes which have the same area as the seed node. In the editor areas are displayed as different colors of the nodes. The only case where it will not be so is when there is a one way path from some part of the area to the seed node but no path from the seed node to that part of the graph.
The returned list is sorted by node distance from the seed node i.e distance is measured in the number of nodes the shortest path from seed to that node would pass through. Note that the distance measurement does not take heuristics, penalties or tag penalties.
Depending on the number of reachable nodes, this function can take quite some time to calculate so don't use it too often or it might affect the framerate of your game.
seed | The node to start the search from |
tagMask | Optional mask for tags. This is a bitmask. |
Returns if there is a walkable path from n1 to n2.
If you are making changes to the graph, areas must first be recaculated using FloodFill()
|
static |
Returns if there are walkable paths between all nodes.
If you are making changes to the graph, areas must first be recaculated using FloodFill()