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. Dismiss Notice

NavMesh Agent avoiding it's self

Discussion in 'Navigation' started by McSwaggens, Apr 24, 2017.

  1. McSwaggens

    McSwaggens

    Joined:
    Jan 17, 2013
    Posts:
    23
    I have GameObjects/Units I want to move around the map whilst being able to avoid each other.
    I've attached a NavMesh Agent and a NavMesh Obstacle to the units and I've encountered a problem:
    When I move the unit with SetDestination it starts to avoid it's self.
     
  2. Jakob_Unity

    Jakob_Unity

    Unity Technologies

    Joined:
    Dec 25, 2011
    Posts:
    269
    You should also see a warning in the console :
    "NavMeshAgent and NavMeshObstacle components are active at the same time. This can lead to errorneous behavior."
     
  3. McSwaggens

    McSwaggens

    Joined:
    Jan 17, 2013
    Posts:
    23

    So is there a way to use an agent and have other entities avoid it?
     
  4. Jakob_Unity

    Jakob_Unity

    Unity Technologies

    Joined:
    Dec 25, 2011
    Posts:
    269
    The agents are supposed to avoid each other - depending on some settings like 'obstacleAvoidanceType' and 'avoidancePriority'
     
  5. GameDeveloperAf

    GameDeveloperAf

    Joined:
    Jul 3, 2020
    Posts:
    71
    But there is not another way to solve this issue? Everything working perfect. But the navmeshobstacle cause issues. The navmeshonbstacle avoid from itself too. I want to know is there any way to ignore self navmeshobstacle from avoid???
     
    kyuskoj likes this.