Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

NavMesh Links Auto Generate

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

  1. Shinobi1507

    Shinobi1507

    Joined:
    Sep 8, 2010
    Posts:
    213
    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:
    232
    Hello Shinobi1507,

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



    Hope it helps
     
  3. Shinobi1507

    Shinobi1507

    Joined:
    Sep 8, 2010
    Posts:
    213
    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. Shinobi1507

    Shinobi1507

    Joined:
    Sep 8, 2010
    Posts:
    213
    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
unityunity