- Home /
NavMesh.CalculatePath is acting weird
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);
NavMeshPath path;
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?
Answer by tiredamage42 · Jul 07, 2018 at 07:10 PM
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
Answer by dbrizov · Mar 03, 2019 at 04:58 PM
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
Your answer
Follow this Question
Related Questions
Navigation Mesh + Doors 0 Answers
Getting a navmeshagent back on a navmesh. 1 Answer
Navmesh on all sides of an object? 0 Answers
NavMesh.SamplePosition returns point outside the NavMesh 0 Answers