Hi there,
I stumble upon it since I use AC, but lately it's becoming really strange. The pathfinding in my scenes is way off of being usable. I use the mesh collider system with NavMeshes that I build in Blender with the rest of my scene. Look at this screenshot as a reference:
If the player stands at position "Start" and I click to the position "End", he walks the red path to reach the aim (along the outside of the NavMesh).
Another weird situation:
In this situation the character walks the red path (the longest), but shouldn't he walk the blue path to reach his aim? And sometimes he just takes the straight way through the air...
I think I'm doing something wrong, does anyone have a clue to this?
PS: I am currently thinking of calling my game "The longest journey", but that could bring me into serious trouble...
Yours
Marcus
Comments
Try also changing your Destination accuracy slider in the Settings Manager. If your characters are very much bigger or smaller than the demo game's character, you may need to have a different value.
If all looks OK and you continue to have problems, there's always the option of using Unity Navigation instead.
As I recently found out that you could have gizmos activated in the game window and the calculated path is visible there, I did some more testing and discovered some things. The behavior in the first screenshot is shown if the character walks outside of the NavMesh, which is possible due to the fact, that he is walking using root motion. It seems like he is walking around the NavMesh then to enter it somewhere else and after that walking to the point I clicked. I made a video yesterday evening to show this better, but was not able to upload it. I will try to do it when I'm home again.
Concerning the behavior in screenshot 2: Is it possible, that the pathfinding algorithm declares the shortest path the one that leads over the minimum number of vertices instead of calculating the real lengths of the path parts? That would explain the behavior.
I try to avoid Unity pathfinding, because I make heavy use of more than one NavMesh in my scenes (eg. a boat that comes to a landing pier and that you could walk in then).
I took a look at the NavigationEngine_meshCollider script and it indeed takes the vector distance into account. I'll try to trick the algorithm by altering the NavMesh layout in the critical areas.
I also did some additional edge slides in my NavMesh wich makes pathfinding a lot better (Screenshot 2). To keep the number of vertices to the bare minimum is possibly not the best solution for some situations.
Once again thanks a lot for your help.