Jump to content

Gaia 3.2.1 - Baking NavMesh for multiple tiles


gabriel_fuentesGD

Recommended Posts

Hey guys!

I'm trying to figure out how to have NPCs travel across my Gaia terrain. These NPCs need to use pathfinding and I was thinking about using NavMesh components to make them move around. My world is divided into multiple tiles, so that means I would have to bake a NavMesh for each tile in the world using the NavMesh Surface component. I'm having a problem, where NavMesh agents only stay on their current tile's NavMesh and won't cross to another. Is there a way to stitch these NavMeshes together? Is there a different or a better way to handle open-world AI navigation?

I'm aware of the existence of NavMeshLink, but it seems like a suboptimal and very manual solution.

Thanks in advance!

Link to comment
Share on other sites

@gabriel_fuentesGD The Gaia terrains are standard unity terrains - if the terrains are all stored in a single scene, the navmesh should bake across all terrains, if the terrains are stored in multiple scenes the rules of "Multi-Scene-Editing" apply: If you have multiple scenes loaded in at the time of the bake, the terrains contained in these scenes will be baked together, and the resulting navmesh will be shared across these scenes.
The manual also mentions this function to build a navmesh on multiple scenes from code: https://docs.unity3d.com/ScriptReference/AI.NavMeshBuilder.BuildNavMeshForMultipleScenes.html
(I do not know however if this function has less overhead / works better than simply loading in the scenes manually in the editor and starting the bake)
Then there is the NavMeshLink, which you already mentioned. You could of course put down some navmesh links manually, but if I remember correctly they do not connect correctly anymore when scene loading is used. What I did once in a personal project was I created a script that would create nav mesh links between two terrains automatically, e.g. when a new scene was loaded in I would check every 5 meters if the navmesh on both terrains has a valid position, then connect the two spots with a navmesh link on both sides.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...