Search Unity

NavMesh Agent not avoiding obstacles correctly

Discussion in 'Navigation' started by lukagril, Dec 14, 2016.

  1. lukagril

    lukagril

    Joined:
    Nov 29, 2016
    Posts:
    48
    Hello,

    I have a normal map with flat ground. There are couple of buidlings on the floor, which all have NavMesh Obstacle component. There are some tanks (NavMesh Agents) which need to navigate over the map. But those tanks aren't avoiding obstacles correctly. When they come close, they start avoiding them, but some of them still hit obstacles. Is there any alternative to NavMesh system, that calculates path more accurately ?

    Regards, L
     
  2. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
  3. sarahnorthway

    sarahnorthway

    Joined:
    Jul 16, 2015
    Posts:
    78
    Old thread but the issue for me was that NavMeshObstacles don't affect agent paths by default (odd choice); they only act as colliders, so my agents were bumping and sliding and even slipping through locked doors trying to get into sealed off rooms. Not sure this is ever useful behavior, but:

    Once you tick the "Carve" box on a NavMeshObstacle, that means it'll carve out a hole in the navmesh and agents will no longer try to walk straight through locked doors and other obstacles.
     
    SlowSeer, rezaalidad, harryjc and 8 others like this.
  4. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Hey Sarah, to shed some light on this: carving is a relatively expensive operation you generally want to avoid doing over and over again.So the obstacles turn off carving by default under the assumption your obstacle is a moving body (something like a rolling barrel) with the idea you'll manually turn carving on when it settles and turn it off again when it begins to move.
     
    BroVodo likes this.
  5. ANLevant

    ANLevant

    Joined:
    Jun 10, 2014
    Posts:
    28
    My god dammned heroine!