Recast Graph stiching

Turns out you’re wrong about the second case! Bridges are certainly possible; you even wrote about it yourself! From the docs of NavmeshAdd:

  • This component has a few very specific use-cases.
  • For example if you have a tiled recast graph
  • this component could be used to add bridges
  • in that world.
  • You would create a NavmeshCut object cutting out a hole for the bridge.
  • then add a NavmeshAdd object which fills that space.
  • Make sure NavmeshCut.CutsAddedGeom is disabled on the NavmeshCut, otherwise it will
  • cut away the NavmeshAdd object.
  • Then you can add links between the added geometry and the rest of the world, preferably using NodeLink3.

And it works!
https://youtu.be/8bzdNOEZwLg

The only issue here is that NavmeshCut/NavmeshAdd is runtime-only, but that’s fixable from the things I posted in this thread: NavMesh cutting during bake, so I can get the above result to happen during bake, and then delete all the involved scripts on Play.

There’s a visible problem, though, and that’s that the stuff added by NavmeshAdd doesn’t hit the same areas. That’s due to them not overlapping exactly, and Pathfinding.Polygon.CompressMesh being very strict about when two vertices are the same one. I can handle this by making the entire mesh in blender, but I’d prefer to have the bits be a bit better at combining.
The top and bottom also doesn’t connect with the mesh there, as there’s no vertice overlap. So I think I’ll make a custom thing that deforms the mesh around the bridgehead, and then manually stiches the new meshes into the main mesh. Just jamming new TriangleMeshNodes into a Tile is pretty straight-forward, so I think I’ll be good to go.

This is what I like about this whole plugin; it’s very extendable, and for the most part the code is easy to understand when I really dig in there. And when the code’s a bit messy in places (TileHandler.CutPoly), you do say sorry in the comments :slight_smile:

1 Like