Local control over nav mesh density for recast graph


This movie explains my issue: https://arturmandas.com/tempVids/recastUglyCrossing.mp4

I have a pedestrian crossing, and I want to have local control over the shape of the navmesh at that area. Is it possible to force a higher density locally or otherwise make the namesh better fit the target control shape (pedestrian crossing in this case)? The end product would be a huge city block, so I want sparse nodes, this is why I am trying recast graph.


@aron_granberg is this possible, other than having a recast with very small voxels? If no, which graph would you recommend for large city block simulation with pedestrian crossings? I was thinking of recast, but it is grid graph that for now seems better suited for the task.


You can manually add splits in the navmesh by creating a NavmeshCut and setting the isDual setting to true. That might help you. NavmeshCut - A* Pathfinding Project

Wonderful, thank you very much

@aron_granberg Is there a way to use mesh colliders of an object as a cutting source for the recast nav mesh? My scenario (apart from the crossings) is that I want buildings to cut holes in the ground for pedestrians not to walk into buildings. For grid graph, I can set obstacle layer. Here, if I exclude Buildings layer from recast graph computation, the nav mesh includes terrain on which buildings stands (so then people walk through them). Now, if I include buildings, the navmesh is cut nicely BUT also the top of the buildings is calculated as a part of the navmesh. So maybe there is a way to exclude those parts (like a nav mesh cutting modifier - is there a handle for that in code)? Or is writing a script that generates flat mesh from top-down view and then nav mesh cut that a best way out?

@aron_granberg I’ve sent you a link to repo via DM.

You can add the RecastMeshObj component to those buildings. On it, there are settings for marking the object as unwalkable.