Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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

    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 ?
     
  5. MarinRiveraSD

    MarinRiveraSD

    Joined:
    Sep 13, 2021
    Posts:
    1
    exposed now ?
     
  6. Ashanex

    Ashanex

    Joined:
    May 2, 2019
    Posts:
    29
    I would like it to be exposed please, it would save a lot of performance on my game to just get it instead of calculating it myself.
     
    bgebitekin likes this.