Search Unity

NavMesh Links Auto Generate

Discussion in 'Scripting' started by TylerCode_, Jul 22, 2017.

  1. TylerCode_

    TylerCode_

    Joined:
    Sep 8, 2010
    Posts:
    221
    So I recently released Fire-Boy as a prototype and I'm having a small navigation problem with the procedurally generated level.

    I got the automatic generation working great and I was really impressed by it. My problem came when I was watching a friend play the game and he showed that you could move between 2 corner pieces and instead of the AI crossing that little gap, they would go the long way around to get the player. This is a problem because the player can exploit this and never be hit.

    Now reading through the little documentation, I wanted to confirm my understanding of the system. If you are building the nav mesh in real time, you CANNOT build the jump links too. That's my understanding of it and just wanted to make sure that was the case before having the system check for that edge case and take care of it. I'd rather they can just jump.

    Thanks in Advance!
     
  2. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hello Shinobi1507,

    If you haven't already you may want to watch Unity videos on the topic.



    Hope it helps
     
  3. TylerCode_

    TylerCode_

    Joined:
    Sep 8, 2010
    Posts:
    221
    Thank you for this, I must be doing something wrong but I think the problem is that the meshes get generated but don't actually touch. Or it may be a scripting issue. I'll sort it now that I know what its supposed to be doing. I'll post results here.
     
  4. TylerCode_

    TylerCode_

    Joined:
    Sep 8, 2010
    Posts:
    221
    Okay so for anyone who finds this down the line, you need to add the NavMeshLink component to your level assets and then setup the detection area. It's fairly easy to do and in the video posted by gurayg it has a good example. If you need to see an actual example, on the Github repo, in the examples folder under scenes, find scene 7 and look at the dungeon presets and you will see how it's setup.

    In my case, I setup a new game object with 4 link objects that adds a linker to every corner of every tile, this object gets spawned on top of every tile and deletes itself if no links are made. After the game jam concludes, FireBoy will be the example.
     
  5. eDmitriy

    eDmitriy

    Joined:
    Aug 22, 2013
    Posts:
    13
  6. macsimilian

    macsimilian

    Joined:
    Sep 19, 2020
    Posts:
    25