I’ve managed to connect my nodes in the point graph and see if there is a path between two of them.
But how do I get the shortest path from the source node to the destiny node? Is there a function that returns a list of nodes giving as parameters two of them without having to call startPath?
There is no method for that. But I guess this would work.
`
using Pathfinding;
public List GetNodes (GraphNode a, GraphNode b) {
List result = null;
ABPath p = ABPath.Construct (a,b, delegate (Path _p) {
ABPath p2 = _p as ABPath;
result = p2.path;
});
// Wait until the path is calculated
AstarPath.WaitForPath §;
return result;
}`
Note: The above code has not been tested or checked for compile errors, but something like that should work.
You can get the closest node to a point using AstarPath.active.GetNearest (…), see docs.
PS: Depending on if you are using the beta or the released version, you might have to change from GraphNode to Node or vice versa.
@aron_granberg I’m sure this method is very useful for the most basic path finding solutions… for example “batch wall/street building” in a grid/isometric game. Please consider the possibility to integrate this code (or a better one) in the future versions