Destination at Navmesh edges


New member
Hello everyone,

I was making some test using BD with Movement Pack. Noticed some weird behavior and wanted to ask.
Wander task is setting some random location on a navmesh.
But sometimes that location is on the edge of the navmesh surface and things start acting weird.
Is there any way to use an offset on the Wander Task' destination, so it doesn't set destinations close to edges as "valid"?


Here is a screenshot of the issue. Orangish/reddish circle is Agent's destination.
The line with arrow turns red if the destination is close to navmesh' edge, otherwise it is the same color as destination.
My "Arrive Distance"(2) is greater than Agent's Stopping distance (0)


Staff member
When wander is searching for a destination it first samples the position to determine if it's valid. This is done within Wander.TrySetTarget. There isn't anything built into the wander task right now to not set the destination if the character is near an edge but looking at the NavMesh API there is a FindClosestEdge method that looks useful. I will add that to my todo list!