Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NavAgents at different height NavMeshes are pushing each others

Discussion in 'Navigation' started by unity_tyvmsJ5W4uaVRQ, Jul 12, 2019.

  1. unity_tyvmsJ5W4uaVRQ

    unity_tyvmsJ5W4uaVRQ

    Joined:
    May 15, 2018
    Posts:
    2
    Hi!
    We are trying to make a simple movement for ground units and for flying units. The issue is that the units are pushing each other when they are near, even they are moving on different nav meshes.

    Two NavMeshes: Ground plane at y = 0 and aerial plane at y = 1.
    Two Nav Agents: Each one with a different area mask.

    upload_2019-7-12_12-23-2.png upload_2019-7-12_12-23-35.png
    upload_2019-7-12_12-35-22.png
    There isn't any overlapping at NavAgent height (0.3) configuration

    We have tried with different navAgent height and it seems it has nothing to do with this kind of avoidance. In fact, agents with reduced radius are not pushing, which shouldn't affect.
    Also, we have disabled generating off mesh links, set the slope and the step height to 0.

    Attempt 1: Height 0.3 and radius 0.5


    Attempt 2: Height 0.1 and radius 0.5


    Attempt 3: Height 0.3 and radius 0.2


    Our temporal solution is to place the air navmesh higher (y = 2) and place the mesh on a child, so we have the same flying visual effect that we need, but we are not sure if this can cause problems in future. Has anybody come across this issue and find a solution? Are we missing something or is this a Unity's bug?

    Thanks for your help!



    EDIT:
    We have tried modifying the base offset too and it doesn't work.
    Also, we can't modify the avoidance quality to None as we want agents on the same navmesh to avoid each other, but not avoiding the agents on the other one.
    We played with different priorities as well and the result was that only one agent could push the other one, so that won't work either.
     
    Last edited: Jul 12, 2019
    BowlingPin likes this.
  2. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Not really sure what is going on but you might want to try changing:
    -Base offset
    -Obstacle avoidance Quality set to "None"
    -Priority based on your navmesh height.

    Hope those help.
     
  3. unity_tyvmsJ5W4uaVRQ

    unity_tyvmsJ5W4uaVRQ

    Joined:
    May 15, 2018
    Posts:
    2
    Hi, thanks for your response!
    We have tried modifying the base offset too and it doesn't work.
    Also, we don't want to modify the avoidance quality to none as we want agents on the same navmesh to avoid each other, but not avoiding the agents on the other one.
    We played with different priorities as well and the result was that only one agent could push the other one, so that won't work neither.

    Thanks for your time :)
     
  4. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Crowd handling is a separate thing from navigation internally. They create a crowd and agents are moved using the crowd algorithm constrained to the path. So my guess is Unity just uses a single crowd, not one per surface. Which makes sense. You can setup surfaces for all types of situations, a single crowd is the only logical choice unless they expanded the system to let you specify other configurations. And I wouldn't hold my breath on that happening any time soon.
     
  5. nikk98

    nikk98

    Joined:
    Mar 8, 2021
    Posts:
    43
    I'm wondering if anyone found a solution to this. I'm having the same problem.
     
  6. ElevenGame

    ElevenGame

    Joined:
    Jun 13, 2016
    Posts:
    146
    Hm, I don't know if I can be helpful, why are you guys using a navmesh for flying units? I thought navmesh is supposed to bake the details of which places agents can be or not. If your unit is flying it can go anywhere it wants, right? The actual baked navmesh would only be a big quad within the level boundaries. And if thats not the case and maybe big trees or towers would cut into the "flying navmesh", why not just bake it on the ground in the first place? You can bake different areas, some where only air units can travel and others where both types of units are allowed. Then all of your units can travel on this one navmesh, you just have to lift the flying ones up in the air and make sure they dont collide with the ones on the ground.. Anyway, Merry Christmas :D