Querying SamplePosition with a point that’s not on the navmesh, is not returning a hit even when there is one well inside the query range.
Is this expected? If so why?
Querying SamplePosition with a point that’s not on the navmesh, is not returning a hit even when there is one well inside the query range.
Is this expected? If so why?
Here is a pic showing the stuck position. This is actually not an easy problem to solve. You can’t prevent an agent from landing outside the navmesh easily. Moving with velocity or obstructions can easily cause an agent to land on even just 0.01 units away from the destination, causing SamplePosition to then fail.
And there is no good way I can think of to get the closest point on the navmesh that will line up correctly with the final destination. You can’t just for example query a point in the direction of the destination, because like in this pic the destination direction could just lead off the edge of the dock. Resulting in an odd looking first step out of this situation.
I thought of storing the last destination point, but that fails in my case also, because agents can leave the navmesh (to get on a boat) and then get placed back on the navmesh in a different location.
Actually nevermind all that, this has to be a bug pretty much by definition. I’ll just work around it as best I can for now.