How can i get nearest walkable position of vector3 position
aa = new Vector3(6,7,0)
for example aa is not walkable i want to get nearest walkable position of aa
How can i get nearest walkable position of vector3 position
aa = new Vector3(6,7,0)
for example aa is not walkable i want to get nearest walkable position of aa
This may not be exactly what you’re looking for, but NavmeshBase.GetNearest will get you the closest node to your given position, and you can specify walkable.
For getting the exact position of the edge, you may have to write some edge-detecting code using NavmeshBase.IsPointOnNavmesh, where you incrementally try to get closer and closer to the edge (probably within a certain threshold) and return that point. I’m not seeing anything that’ll get the closest point on the graph that already exists.
Does that suffice?
And for getting the closest walkable point on any graph you can use:
var nearest = AstarPath.active.GetNearest(some point, NNConstraint.Walkable);
// Closest node to the point
var node = nearest.node;
// Closest point on the graph surface
var position = nearest.position;
Thankss that what i am looking for