Search Unity

In an RTS game, how to let the hero automatically push away other units?

Discussion in 'Navigation' started by Karsim, Jan 5, 2021.

  1. Karsim

    Karsim

    Joined:
    Jun 20, 2019
    Posts:
    14
    Hi, I am developing an RTS game with Unity's NavMesh. But I want the heroes in the game to automatically push away the units in the way, but I can't find a perfect way to achieve it.

    I tried a way to set the Avoidance Quality of the hero's NavMeshAgent to None. Although I can get the result I want. But then the heroes will overlap and no longer collide.

    So I want to ask if there are other better ways to achieve that.

    And in fact, I wanted heavy units to automatically push away other light units, but this is more difficult to achieve.
     
  2. Vharz

    Vharz

    Joined:
    Jul 28, 2012
    Posts:
    25
    Just change the hero's agent avoidance priority to a lower number than of those of regular units (default is 50 I think).
     
    MahaloAloha and Karsim like this.
  3. Karsim

    Karsim

    Joined:
    Jun 20, 2019
    Posts:
    14
    Oh, thank you very much !
    :oops:It turns out that this is the usage of avoidance priority......