Search Unity

NavMeshAgent being Nav Mesh Obstacle at the same time

Discussion in 'Navigation' started by Chronobane, Dec 22, 2018.

  1. Chronobane

    Chronobane

    Joined:
    Dec 24, 2017
    Posts:
    16
    Hello,
    Imagine a small road with 2 people crossing each other.
    Both should walk to a certain point but at the same time not going through each other, using NavMesh systems.
    So, how would I create a dynamic mesh where the agents do not collide with each other?

    Edit: Also, imagine at this road there would be a car, this car is also a NavMeshAgent, but uses another layer of walkables. For the car, other cars and also people are an obstacle, and same goes vice versa. The cars should stop before they collide with people, while people should just find another route.

    Do you have any idea on how to solve that problem? Or have any idea?
    I guess this might also be far to calculative to work properly at all... Let's say we have got 100 people and 50 cars.
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    According to the documentation, NavMeshAgent's avoid each other using their Radius setting. It seems there is no NavMeshObstacle needed for just NavMeshAgent<>NavMeshAgent avoidance.

    https://docs.unity3d.com/Manual/class-NavMeshAgent.html
     
  3. Chronobane

    Chronobane

    Joined:
    Dec 24, 2017
    Posts:
    16
    Hmm yeah okay but they should also calculate their path according to others, not only avoid.
     
  4. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    368
    Avoidance is not just based on the agent size values but also the Obstacle Avoidance settings.

    Obstacle Avoidance
    Quality Obstacle avoidance quality. If you have high number of agents you can save CPU time by reducing the obstacle avoidance quality. Setting avoidance to none, will only resolve collision, but will not try to actively avoid other agents and obstacles.
    Priority Agents of lower priority will be ignored by this agent when performing avoidance. The value should be in the range 0–99 where lower numbers indicate higher priority.
     
    david_homoludens likes this.
  5. RivenWork

    RivenWork

    Joined:
    Nov 11, 2015
    Posts:
    10
    The settings cannot fit my requirement: that all the agents can not push each others, but not if set the Obstacle Avoidance.
     
  6. dichtermut

    dichtermut

    Joined:
    Jul 21, 2018
    Posts:
    26
    I'm in a similar position, were you able to find a solution?
     
  7. samad_programmer

    samad_programmer

    Joined:
    Jan 20, 2020
    Posts:
    4

    here is the solution
     
  8. Dragnil_7

    Dragnil_7

    Joined:
    Jan 26, 2022
    Posts:
    2
    Awesome, Thanks!