How to use NavMesh.CalculatePath()?

Forums 💬 FlowCanvas ⚙️ Support How to use NavMesh.CalculatePath()?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12170
    ruffleneck
    Participant

      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.

      [attachment file=”Screenshot 2021-12-30 05.02.52.png”]

      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.

      [attachment file=”Screenshot 2021-12-30 05.17.47.png”]

      The node/function is this https://docs.unity3d.com/ScriptReference/AI.NavMesh.CalculatePath.html in script reference

      #12173
      spayke
      Participant

        idk if it will be useful or not but i did it like this:

        #12172
        ruffleneck
        Participant

          [quote quote=3198]idk if it will be useful or not but i did it like this: [/quote]

          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 🙂

          #12171
          ruffleneck
          Participant

            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

            [attachment file=”Screenshot 2021-12-30 16.04.26.png”]

            Here’s when you press play, and it fails to create the path; Look at top right, the path variable becomes uninitialized variable

            [attachment file=”Screenshot 2021-12-30 16.04.42.png”]

            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

            [attachment file=”Screenshot 2021-12-30 16.07.45.png”]

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.