Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Exact path of a NavMeshAgent

Discussion in 'Navigation' started by t3hr0xx0rz, Dec 22, 2019.

  1. t3hr0xx0rz

    t3hr0xx0rz

    Joined:
    Dec 20, 2019
    Posts:
    1
    So I'm trying to show the path of how a NavMeshAgent will move, accounting for momentum and angular velocity. I'm currently using LineRenderer to draw the calculated NavMeshPath, but since I'm only accessing NavMeshPath.corners I'm just drawing straight lines between corner points and not the fully accurate paths, i.e. not displaying the extra distance an object will take to round a corner at high speed.

    Are there any ways to display the actual, curved path the agent will take?

    Thanks!
     
  2. Whipexx_DigitalSun

    Whipexx_DigitalSun

    Joined:
    Aug 8, 2017
    Posts:
    17
    As far as I know, there aren't any perfect solutions.
    If your surface changes in height, the lines will likely go through some parts of it and float above others, as only actual direction changes create a corner. If you have agent avoidance, that'll also modify the real path; I think this is the biggest issue.

    I only see two approaches: either predict the real path, at this point you might as well be using a custom agent; or if you have some time beforehand you could pre-calculate the path with a ghost agent, and store its actual movement path.
     
    gillemp likes this.