Destination at Navmesh edges

gurayg

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"?

1051

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)
 
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!
 
I've seen the 1.6.4 update but couldn't see an update to Wander task.
Do you still have plans to find a solution to this.

I made a small search and saw this is a common problem that people are having with Unity Navmesh in general.
Fixes I saw include
-using the Warp() function when agent gets stuck.
-using half of agent radius as an offset to navmesh edges when sampling a point.
but I'm not so sure which would work as I haven't tested any of those.

Anyways
Hope you have a solution for this in the future.
 
I haven't done a Movement Pack update yet but it is overdue. I'll try to do it after we release version 2.2 of our character controllers.
 
Top