Check point for reachable

Hi, is there a way to learn a point whether is in navmesh or not?

If you’re using a GridGraph you can use GetNode() to request a node and then check to see if it’s null. Or if you’ve got a couple of nodes and want to know if a path between them is possible you can use PathUtilities.IsPathPossible(fromNode, toNode) https://arongranberg.com/astar/docs/pathutilities.html#IsPathPossible

And lastly there’s GetNearest() which is available on all graph types: https://arongranberg.com/astar/docs/navgraph.html#GetNearest Then you can use the (Vector3) node.position to see if the nearest node is at an acceptable position:

Vector3 desiredPosition = new Vector3(x, y, z);
Vector3 actualPosition = (Vector3) AstarPath.active.GetNearest(desiredPosition).node?.position;
if (Vector3.Distance(desiredPosition, actualPosition) <= someAcceptableRange) {
   // Node was close enough, do stuff here
}
1 Like

Thank you for asnwering.

1 Like