I am creating a system where i need to use the CalculatePath method for generating a road for my character. But i have some issues with it. It doesn’t handle slopes that well. The code is very simple in this example.
Vector3 startPos = new Vector3(0,0,0);
Vector3 endPos = new Vector3(10,5,0);
NavMesh.CalculatePath(startPos, endPos, NavMesh.AllAreas, path);
If you look at the image is the left image the one i want. But it calculate the path as the image to the right.
Why does it do that and what can i do about it?
Could you show a picture of the nav mesh in the editor? Maybe the original picture used off mesh links. Which can only be used with navmesh agents. And not the static navmesh class
Dude, did you find a solution? I am having the exact same problem. The thing is I want to get the path and manually move my character controller along this path. Unity’s NavMeshAgent doesn’t work for me, because the movement of my character controller is very custom and specific. Actually, I am starting to wonder how their NavMeshAgent is moving along this path just fine without going airborne.
The white line is the path that NavMesh.CalculatePath() function gives me
And here is the generated NavMesh