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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
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).