Unexpected behaviour with recast graph

Hello there,

I am using the recast graph in my project and when I set the destination of a unit to the center of a gameobject which is unwalkable terrain, then it doesn’t seem to pick the shortest path but instead in my example the longer path to the bottom of the target game object as seen in the screenshot.

Can anyone tell me how to fix this?
I tried increasing the end reached distance a little bit but this doesn’t seem to have any effect when the target is in the center of an unwalkable gameobject.

Thank you

it doesn’t seem to make a difference if the target object is walkable or not. Setting the destination to the center of any gameobject has the same result. This is so frustrating.

Hi

It will always move to the closest point it can reach. In this case the bottom part is probably sliiiightly closer than any other point on the navmesh. One simple trick to work around this is to bias the target slightly towards the agent, so you move it e.g. 0.1 meters towards the agent, which will make points on that side closer.

thanks for the quick answer. This is the workaround I am using at the moment. I probably have to read more about navmeshes because I don’t understand right now how the bottom point could be closer.