Hi,
i need to check if a specific point is reachable, but need the condition for it to fail to be whether the point simply lies on the graph. I’m using a navmesh graph. I tried using isPathPossible, but GetNearest() doesn’t seem suitable as it returns a valid ‘nearest’ point on the graph, lowering the distance in the main settings is not an option as the characters center is a certain height above the ground. I saw the AstarPath.active.astarData.recastGraph.PointOnNavmesh(), but i definitely plan on having more than one graph of the same type (especially navmesh ones). So i guess the only way is to loop through AstarPath.active.graphs and cast every graph to RecastGraph and if not null use the PointOnNavmesh, or is there an easier way?

Edit2: i just realized that Navmeshgraph and recastgraph are different types, so what can i do to achieve what i want?

Edit3: I can’t see a way to find a path between two nodes, only between positions, but that could help as i could try distance-checking the nodes i get from Getnearest.

The core of my problem is that i have npcs that should not go to a target if it is outside the navmesh

Usually it is good to leave a small margin so that if the target is just outside the navmesh, it will still find it.

The easiest possible solution is

var nnConstraint = NNConstraint.Default;
var nearestPoint = AstarPath.active.GetNearest(somePosition).clampedPosition;
nearestPoint.y = somePosition.y;
if ((nearestPoint - somePosition).sqrMagnitude > 0.5*0.5) { // Or some other very small constant
// Inside!
}

The only potential problem is if the nearest node is on a slope, then the nearest point will not be the point which is directly below it in XZ space, but it should be fine as long as your valid target points are not too far above the navmesh.

For a recast graph the best solution would be to loop through the graphs and test for PointOnNavmesh.

Thx, so i can be sure that the position i get from GetNearest(positionEnd) is the same that seeker.StartPath(positionStart, positionEnd) finds with positionEnd ?

Yes. The code uses that method internally.
There is one case where it will be different. The closest point might not be reachable from the start point, so it will try to find the closest node to the end point which can be reached from the start point.