Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Pathfinding for Large Worlds

Discussion in 'Navigation' started by unity_1SeL-HQ69UMA9g, Jun 14, 2018.

  1. unity_1SeL-HQ69UMA9g

    unity_1SeL-HQ69UMA9g

    Joined:
    Oct 7, 2017
    Posts:
    6
    Worlds are procedural generated.

    Hello, i am looking for pathfinding, that will be used on large worlds (2000x2000).
    What should i use? I was in almost every thread, on every page and didn't find out :/
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    487
    Well, if it's a procedurally generated world probably your only option is baking the navmesh at runtime. There's a tutorial on that, using the NavMeshComponents system:

    https://unity3d.com/learn/tutorials/topics/navigation/baking-navmesh-runtime

    That said, I'm not sure whether the baking can be constrained to ignore certain chunks of your world. One approach would be to disable the colliders that are far from the player, and rebake as necessary as the player gets closer to that region. For example, assuming your world is broken into square regions, maybe you disable colliders in all but the 9 squares adjacent to the player. When the player moves to a new region, you'd enable/disable colliders in the different areas, and rebake the mesh.

    That's probably only valid if you can't meaningfully interact with parts of the world that are 2000 units away from the player... But this is just an optimization, and maybe it'll work fine even if you keep everything enabled all the time.