- Home /
Dealing With Multiple Navmeshes
Hey guys and gals! Long time reader, first time poster.
I'm working on an indie game at the moment and I've hit a bit of a stumbling block. Our game randomly generates maze-like environments out of large (square) set pieces. Each of these has a custom navmesh we've modeled ourselves. All of our pathfinding and navmesh code was made from scratch by myself, since we weren't sure Unity's built in navmeshes would work for our particular use-case.
My question is simple: how would you merge two navmeshes from a logical perspective? I can figure out the code, I'm just not sure how to logically go about it.
If I simply combine the list of vertices and triangles, I'm still going to have a separation in the middle with no triangles that run between the two set pieces. If I grab nearby verts on each navmesh and make new triangles between them, there's a chance that triangle will overlap an area that shouldn't be walked upon.
Thanks for taking the time to read this. Has anybody tackled something like this before? I need some ideas!
Sounds like it's more of an issue with the way your pathfinding generated nodes from mesh triangles than from different meshes having no connection.
Also, be aware that $$anonymous$$esh.Combine$$anonymous$$eshes exists.
$$anonymous$$y pathfinding algorithm makes each vertex a node with a list of neighbours (any other vertices connected as part of a triangle). The issue is that there are no 'neighbours' between two meshes since no edges run between them.
The combine meshes function is very helpful though, thank you. Does it bridge two meshes, or just append the vert information?
It just combines, but doesn't create any new triangles.
The way you describe your solution sounds like it's largely incompaitlbe with runtime generated meshes, since those based on tiles or also usually consist of seperate quads with no connection, in order to be able to uv-map the same mesh and use it for the floor terrain.