Search Unity

[Solved] NavMeshAgent behaves like an astroid

Discussion in 'Navigation' started by mapa17, May 21, 2019.

  1. mapa17

    mapa17

    Joined:
    Jan 27, 2019
    Posts:
    14
    Hi,

    I have difficulties making a nav mesh agent walk 'reasonable' paths toward its destination.

    Captura de pantalla 2019-05-21 a la(s) 17.35.51.png

    Instead of taking the shortest path, the agent is kinda like an astroid within a gravitational field, moving in concentric circles towards the target.

    Captura de pantalla 2019-05-21 a la(s) 17.37.25.png

    Should this be the normal behavior? Or how can i prevent this?

    best,
    Manuel
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    This seems to be a recurring edge case I've seen a few times, I believe it's a result of the NavMesh' triangulation. Can you perhaps show the NavMesh at that location, are there a ton of extra triangles there?
     
  3. mapa17

    mapa17

    Joined:
    Jan 27, 2019
    Posts:
    14
    Ok, but is there a way to avoid this?
    Captura de pantalla 2019-05-23 a la(s) 22.40.14.png
     
  4. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    I think people just solved it by messing with the object placement until it stopped messing up. Sorry to not be of more help...
     
  5. mapa17

    mapa17

    Joined:
    Jan 27, 2019
    Posts:
    14
    I found the following post ( https://answers.unity.com/questions/236828/how-can-i-stop-navmesh-agent-sliding.html )
    that suggested to increase the acceleration.

    Setting it to 100 in my case solved the issue. The deceleration is than strong enough to keep the agent on 'straight' lines lets say.

    I do not understand though, how and where the user can define the object inertia. Is this a physics engine result of the agent having a mesh?
     
  6. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    That's a surprising solution.
    Unless your agent has a rigidbody that's not set to kinematic, the physics engine does not influence your agents at all.
    So inertia shouldn't be a factor at all. (Also, the physics engine and navigation system do not play along nicely).
     
  7. DanielThomas

    DanielThomas

    Joined:
    Mar 30, 2013
    Posts:
    111
    While it has already been solved, for future reference, I think this could be what's going on and a pretty good solution provided as well: