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.

How does one access a NavMeshAgent's neighbours?

Discussion in 'Navigation' started by Arsonide, Apr 17, 2017.

  1. Arsonide

    Arsonide

    Joined:
    Nov 16, 2009
    Posts:
    43
    So, if you look in the editor with the Navigation tab open, and select a NavMeshAgent, there is an option to "Show Neighbours", which shows all other nearby agents, so clearly the neighbours are already calculated somewhere. I assume they are used for local avoidance.

    Is there some way to access them? If not, there should be, as that would greatly reduce the complexity of finding other nearby agents.

    Right now my use case is having the agent look at other agents it is passing. I am aware there are other ways of doing it, just thought using the agent's neighbours would be more efficient.
     
    Drottin likes this.
  2. Jakob_Unity

    Jakob_Unity

    Unity Technologies

    Joined:
    Dec 25, 2011
    Posts:
    269
    It's not exposed yet - but you're not the first to ask for it, it's on our list.
     
  3. TomPo

    TomPo

    Joined:
    Nov 30, 2013
    Posts:
    86
    Bump!
    this should be exposed for sure. So many opportunities missed :(
    Calculate agents at front - to find better way mabye if to many of them.
    Calculate distans to other agents within some range - then should be an option to change radius to check neighbours.
    Sure we can all make with workarounds like triggers or some raycasting but why if such a feature is already here?
    Would be very helpful for some crowd control I think.
     
  4. Maxanox

    Maxanox

    Joined:
    Feb 13, 2023
    Posts:
    1
    exposed now ?