Search Unity

Question Nav Mesh Agent avoiding enemy range

Discussion in 'Navigation' started by dichtermut, Apr 3, 2023.

  1. dichtermut

    dichtermut

    Joined:
    Jul 21, 2018
    Posts:
    26
    All my units have a detection radius (Gizmos showed below) which defines the units that they are aware of.
    One type of unit, representing a thief, should be able to walk outside the detection radius of their enemies, while trying to infiltrate the enemy's base.

    I tried to accomplish this effect by declaring the enemies as Nav Mesh Obstacles, but then they carve out their own navigation mesh not only for the blue 'thief' unit, but also for all their allied red units and for themselves. (The rest of the blue units, also, don't care about this detection radius obstacle, since they don't have to actively avoid it, just the thiefs).

    upload_2023-4-3_17-26-13.png

    I then tried to declare a new agent for the 'thief' unit, but the parameters that Unity allows to configure the agents don't help me in this.

    So my question is: is there a way that I'm missing that allows me to apply this functionality using Unity's AI package? I think that this should be a quite used functionality so, if not within Unity's AI, is there any asset that could do what I explained, or should I implement it from scratch?