- Home /
Navigation: Approach Destination from Correct Direction
I have the following setup:
The goal of the NavMeshAgent is to interact with the rightmost obstacle. Therefore, I set the destination to the middle of the obstacle with enough stopping distance that it's definitely reachable.
The problem is: In my tests, the NavMeshAgent always approached the target from the left side. Which means that if the left side isn't reachable (like in the drawing), the NavMeshAgent is clueless and doesn't move. If I remove one of the left obstacles, the NavMeshAgent simply walks around and approaches the destination from the left side.
How can I make the NavMeshAgent always approach his destination from a side that is actually reachable?
Thanks!
If I offset the destination a bit to the right, the Nav$$anonymous$$eshAgent always comes from the right side. But without implementing pathfinding myself, I can't really know which side is reachable and which isn't, can I?
I was thinking: $$anonymous$$aybe one could check if the Nav$$anonymous$$eshAgent finds a path. If he doesn't, move the destination in a direction and check again. If still not, move it in the other direction, check again and so on. $$anonymous$$aybe this works, but it seems like a really bad approach to me.
Your answer
![](https://koobas.hobune.stream/wayback/20220612143749im_/https://answers.unity.com/themes/thub/images/avi.jpg)