Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. 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 pathfinding on multiple layers changing at runtime. How is it done?

Discussion in 'Navigation' started by cnio14, Jul 19, 2020.

  1. cnio14


    Jun 19, 2020
    So I'm working on a builder-type game where you place blocks (think minecraft) on top of each other creating layered structures. Each block is walkable on its top surface and can be reached through ramps. AI agents are supposed to reach these blocks to use their functionality.

    Now, the NavMesh system is making me go absolutely insane. To start, pre-baking the whole NavMesh is pointless since it's a builder game where the player places the blocks, which means the level will change all the time. We all know that updating the NavMesh at runtime is basically impossible for some obscure reasons. I tried using NavMeshSurfaces, baking them on top of the cubes and stitching them together with NavMesh Links at it kind of worked. The problem is that connecting every single 1x1 block to the adjcent ones via links is not only very complex and unelegant and prone to bugs, but also creates very weird and janky movement behaviour.

    A* has a module for layered grid based pathfinding that would solve my problem but it's slower and costs USD 100 which I really don't want to spend just to try if it works.

    I read every post and forum about this issue and it seems I am not the only one struggling with this. Is something so basic really that difficult to achieve? What's the solution to this in 2020?