Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Nav Mesh Agent Predictability

Discussion in 'Navigation' started by eia, Jan 31, 2016.

  1. eia

    eia

    Joined:
    Jul 14, 2014
    Posts:
    5
    We have 5 different cars and we set their nav mesh agent input parameters at the start. They cross the finish line and the output can be defined by:
    1) Ranking
    2) Relative distance to each other.
    3) Relative time to each other

    We are looking for the exact same, predictable output every time i.e. if we set the same parameter values again as input, they should follow the exact same paths and have the same output values over the entire race. That doesn't seem to happen now. Any pointers?
     
  2. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    That's intended behaviour. You're not going to get predictable behaviour because it's physics.
    Part of the beauty of the system is that it can feel realistic.

    There's only a couple of ways you could achieve what you're after.

    * Give advantage to agents falling behind so they catch up eg. Greater acceleration & top speed.
    * Do the opposite for agents getting too close, reduce their acceleration and top speed.

    The alternative is to hard code your car movement so the cars follow a bezier like animation instead of using the agent.

    NavMeshAgents will never be predictable on their own.