Search Unity

Flying units

Discussion in 'Navigation' started by supervelly, Jun 29, 2019.

  1. supervelly

    supervelly

    Joined:
    Dec 6, 2017
    Posts:
    16
    Hi all.
    I'm using NavMeshAgent for all my units.
    for ground units it's working fine and they cannot walk on water and they are looking for a bridge.

    now I'm trying to implement air units which can fly over the river.
    I'm having a hard time since no matter which config I get the NavAgent nor the NavMesh
    I cannot seem to get it to work

    any ideas?
     
  2. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    226
    You can do it 2 ways, I guess. Create another navmesh for the flying unit where the river is not an obstacle or create a offmesh/ navmesh link across the river where only flying units can take.
     
    supervelly likes this.
  3. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    A simpler solution is to make rivers impassable terrain by using NavMesh areas and marking the river as unpassable for your ground units. Then you make a new agent type for flying units, and make rivers passable for them. Simple as that.
     
    supervelly and mistergreen2016 like this.
  4. supervelly

    supervelly

    Joined:
    Dec 6, 2017
    Posts:
    16
    Thank you guys. helped me a lot :)