Search Unity

NPC without NavMeshAgent

Discussion in 'Navigation' started by GrandmaSquid3, Apr 25, 2017.

  1. GrandmaSquid3

    GrandmaSquid3

    Joined:
    Apr 24, 2017
    Posts:
    1
    Hello everyone!

    I want to create NPC without using NavMeshAgent. I can’t get the desired behavior using NavMeshAgent settings (speed, acceleration and angular speed). For example, speed should depend on orientation in a certain way.

    I can change the settings NavMeshAgent (speed, acceleration and angular speed) at runtime, but I think this is a bad idea. I want to not use NavMeshAgent. It would be convenient to use the NavMesh.CalculatePath, but it is not async in difference from NavMeshAgent.SetDestination.

    What do you advise? Do you use a NavMeshAgent for NPC?
     
  2. BTables

    BTables

    Joined:
    Jan 18, 2014
    Posts:
    61
    Just doing the 5.6 upgrade myself, looking at the same issue.

    Seems like a fairly big oversight given how awesome and flexible the Navmesh generation process is that the consumption of the Navmesh is confined to one non asynchronous method (Navmesh.CalculatePath) or a fully automated closed source agent.

    My use case is our AI is networked, and we query the Navmesh on the server to determine the path of the NPC for the next few seconds, then serialize only the list of corners across the network and traverse the path on both the client and server in a deterministic way perfectly in sync (Using an asset store plugin for the Navmesh). This sends 1-2 transforms per second vs position and rotation updates at 10hz for streamed positions.

    Doing a blocking calculate serverside isn't an option (my simple tests were returning upto 3ms sometimes)

    Seems like my options are:
    A) Creating a NavmeshAgent and setting its speed to 0 and hope the local avoidance, transform updates, and all the other features I don't want aren't causing too much overhead
    B) Try to do a setpath on a client side agent and let the server side agent replace our existing path traversal code

    Any insight would be helpful