Search Issue Tracker
Won't Fix
Votes
0
Found in
5.4.2p4
Issue ID
855522
Regression
No
Agent does not plan shortest path
How to reproduce:
1. Open attached project
2. Open scene test.unity
3. Open the Navigation window
4. Play the scene
5. Select the Agent gameobject
- Note how the navigation debug view displays the planned path to be along the edge of the path
- Moving the Agent around using the transform handles in the scene view causes the path to be recalculated into the actual shortest path
- Reproduced in 5.4.3p1 (00292ff31167), 5.5.0f3 (1d1a0b50d15c), 5.6.0a6 (af2099d5a7ac)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Game view renders artifacts when Camera's Component "Post Anti-aliasing" is set to "TAA" and Dynamic Resolution's "Forced Screen Percentage" is changed
- A deactivated Prefab's name color becomes white when a GameObject in the scene is deactivated
- The Game view becomes blank when using Frame Debugger with MSAA and Texture binding enabled in Play Mode
- Crash on dynamixel_sdk.dynamixel:groupSyncReadTxRxPacket when entering Play Mode after updating path to Dynamixel SDK in script
- NullReferenceException is thrown when changing the Inspector preview selection
Resolution Note (2021.2.X):
As a performance optimization, the current implementation of the Navigation system does not guarantee that the path found towards the destination is always the shortest one (i.e. optimal). To compensate for this limitation the NavMeshAgent will try to optimize the path regularly as it moves towards its destination. Overall, this technique aims to reduce the movement of the agent to the minimum, but it does not guarantee that the reported NavMeshAgent.path will be the shortest one at any given time.
In the cases when the path found through a section of the NavMesh (the game environment) is repeatedly sub-optimal, it is recommended to slightly change the environment geometry in that area such that the NavMesh geometry improves. In turn this will increase the chances of obtaining the shortest path. The geometry of the NavMesh can produce better paths when it does not contain long, thin polygons. Please try to tweak the factors that influence the creation of such triangles. They can be: excessive detail of the obstacle geometry (at the border of the NavMesh), or a low value for the "voxel size" parameter (often used for increasing the accuracy of the NavMesh).