Search Unity

Helicopters, planes and boats navmesh

Discussion in 'Navigation' started by Ay-mak, Jul 26, 2019.

  1. Ay-mak

    Ay-mak

    Joined:
    Jan 25, 2019
    Posts:
    13
    I'm currently making an RTS game and I was wondering, how can I manage multiple navmesh for different agent types (land, air, water). I made a static invisible plane hovering the terrain for helicopters and I wanted to know if it was possible to make the terrain an obstacle for the hovering plane nav mesh so that helicopters can avoid mountains and maybe do the same for the water plane.
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    That can technically work, but in another thread someone tried this approach and discovered that units on different navmeshes still avoid each other, so your planes would try to avoid ground units and vice versa.
    Land and water units could use the same NavMesh, but use different agent types that stop them from passing certain terrain types: land is unpassable for ships and water can't be passed by land units.
    For planes, perhaps you can write a very simple agent type of your own. Planes in RTS games tend to just go to a target in a straight line, and only skirt around obstacles when encountered. Solutions such as "hug a wall and keep turning left when possible" are simple to build and should provide a solid basis.
     
  3. Ay-mak

    Ay-mak

    Joined:
    Jan 25, 2019
    Posts:
    13
    I finally figured it out. I made 2 additional static planes, one for aircrafts and one for boats. Then I set an area type for each plane and baked and it worked great.
     
  4. Cloaked_Gamer

    Cloaked_Gamer

    Joined:
    Jul 22, 2019
    Posts:
    4
    Hey, I'm having a similar issue and was wondering how you went about creating additional planes?