FlowCanvas Forums › Support › How to use NavMesh.CalculatePath()?
Tagged: navmesh, navmeshpath
I’m trying to make an actor create a nav path without using a NavMeshAgent (as I want to use different controller to drive the character itself), but I can’t quite wrap my head around the NavMesh.CalculatePath node. I was able to create a path using NavMeshAgent just fine, but somehow I can’t get path information with the NavMesh.CalculatePath.
I also can’t set a filter for it, I’ve added the NavMeshQueryFilter to the prefs, but it doesn’t allow defining anything in it.
The node/function is this https://docs.unity3d.com/ScriptReference/AI.NavMesh.CalculatePath.html in script reference
idk if it will be useful or not but i did it like this:
idk if it will be useful or not but i did it like this:
Sadly I can’t use a NavMeshAgent and only need a path to follow which is what the NavMesh.CalculatePath() is used for, and if actor has a NavMeshAgent, it kinda overtakes it and force plants the player into ground and not allowing the character to move without it 🙂
Okay, problem solved. I think there’s a minor gripe with FlowCanvas with the NavMeshPath (NOT NavMeshAgent’s NavMeshPath, but NavMesh’s path) and it’s that it loses the initialization of the variable when you enter playmode.
Here you can see the test flowscript outside playmode; Look at top right, the path variable is initialized
Here’s when you press play, and it fails to create the path; Look at top right, the path variable becomes uninitialized variable
And how to get it work; You have to initialize it manually on enable; Look at top right, the myList (Vector3) is populated and the switch condition succeed