I would like to determine if an arbitrary point in the world is reachable (meaning you can pathfind to that point from the current player location). What is the best way to accomplish this?
Something like this:
`
Node n1 = AstarPath.active.GetNearest (transform.position).node;
Node n2 = AstarPath.active.GetNearest (enemy.position).node;
if (n1 == null || n2 == null) {
Debug.Log (“Oh noes, could not find a close node to either my position or the enemy position”);
return;
}
if (PathUtilities.IsPathPossible (n1,n2)) {
Debug.Log (“Yay, we can reach that point”);
} else {
Debug.Log (“No path exists”);
}
See http://arongranberg.com/astar/docs/class_pathfinding_1_1_path_utilities.php#a78c136feba9843851f499b21c86c1731 for documentation.
In a Recast Graph, what exactly are nodes? Are they the center of the triangles that the Recast generates?
Nodes are the triangles, node positions are the centers of those triangles.
GetNearest will find the closest triangle, not just the closest triangle center.
Last question – is there a debug option to render the triangles from a Recast Graph?
Check the Show Mesh Outline checkbox at the bottom of the Recast Graph Settings (also make sure Show Graphs is enabled).