Search Unity

Navmesh - How to calculate a path AROUND a NavmeshAgent Obstacle Radius if in a corner?

Discussion in 'Navigation' started by castor, May 20, 2017.

  1. castor

    castor

    Joined:
    Sep 9, 2012
    Posts:
    40
    I might be missing the obvious since this seems a bit strange of a behavior.

    Let's say we have 2 agents, Agent A and Agent B, and both have an Obstacle Avoidance radius of 0.5.

    Agent B is not moving, and Agent A wants to move towards the TargetPos as illustrated below (blue is the navmesh, the red circles represent the Object Avoidance radius):



    The problem is that Unity always Calculates the yellow path (the shortest possible to the TargetPos) completely ignoring the Agent B avoidance radius, and so, Agent A ends up stuck in the corner, unable to reach the TargetPos.

    What I would like instead, is that when calculating a path, it takes into account Agent B Obstacle Avoidance cylinder and plans around it.
    Is there a way to do it? Is it part of Unity's NavMesh system?

    NOTE: When Agent B is NOT in a corner, the obstacle avoidance works, and Agent A goes around him (even though the calculated path stays the same). It's just in this situation, where going around means doing the LONGER distance, that he decides to go through the shortest path and gets stuck.

    NOTE2: It's not feasible to add a NavMesh Obstacle component to Agent B since that would mean that any other agents that wants to calculate a path towards him (or if he needs to calculate a path to anywhere) it would return as invalid! NavMesh Obstacle component only makes sense for non-agent objects.
     
  2. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    I wonder if changing quality and/or priority settings on the NavMeshAgent ObstacleAvoidance section would affect it?
     
  3. castor

    castor

    Joined:
    Sep 9, 2012
    Posts:
    40
    I'm running in 'High Quality' and tried all the other settings makes no difference.
    As for Priority, all it does is to 'push' the actor with lowest priority out of the way, which is not what I want.
     
  4. castor

    castor

    Joined:
    Sep 9, 2012
    Posts:
    40
    Bumpity bump...anyone?