How to use NavMesh.CalculatePath()?

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3195
    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.

    Screenshot-2021-12-30-05.02.52

    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.

    Screenshot-2021-12-30-05.17.47

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

    Attachments:
    You must be logged in to view attached files.
    #3198
    spayke
    Participant

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

    Attachments:
    You must be logged in to view attached files.
    #3200
    ruffleneck
    Participant

    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 🙂

    #3201
    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

    Screenshot-2021-12-30-16.04.26

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

    Screenshot-2021-12-30-16.04.42

    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

    Screenshot-2021-12-30-16.07.45

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