Is there an equivalent to NavMesh.SamplePosition() in A* pathfinding?

I just purchased A* pathfinding, and am now in the process or rewriting my code to work with A*, and I was wondering if there is a method i can call in A* that works like NavMesh.SamplePosition, which will sample the closest navmesh point to the vector3 provided, or if this is ever necessary? will it automatically find the closest navmesh position to the given vector3 ?


Sure (somePosition).clampedPosition;

You can also pass an NNConstraint to filter which nodes you want it to return.

All movement scripts and paths will automatically run this code when searching for paths, so you don’t really need to do it manually.

ok that’s awesome. thanks alot.

What about if I have multiple graphs and want to sample the position on a specific graph?

You can use the graphMask field on the NNConstraint.

var constraint = NNConstraint.Walkable;
constraint.graphMask = GraphMask.FromGraphIndex(1);, constraint);