I want to randomly generate my destination point, how do I know if it is inside recast graph?

I want to randomly generate my destination point, how do I know if it is inside recast graph?

I don’t seem to find any API that I could to use to see if the point is inside the graph region

One option is to use NearestPoint to find a point within the graph. Compare the distance of this to the original position. If it’s above a threshold distance then it is not within the graph area.

https://arongranberg.com/astar/docs_beta/class_pathfinding_1_1_mathfx.html#aa1dba9eb530bc137662868cea7c891cd

1 Like

I’m doing this:

	GraphNode isOnGraphNode = (AstarData.active.graphs[0] as RecastGraph).PointOnNavmesh(m_requestedTarget, NNConstraint.Default);
1 Like