Support Forum

RecastMeshObj to block navmesh generation?

Hi there!

I have a doubt. I find myself improving the navmesh generation of the project that I am working on. We are using RecastGraph, and until now we were using the graph parameters to make some objects unwalkable (heights, slope etc.) and using different layers that are not only floor, but I think a smarter way would be adding a RecastMeshObj to every object that should block navmesh generation under and on top of it. The question is, our levels are full of props, so probably the amount of RecastMeshObj would be high (a few hundreds probably), so would this be a smart way of dealing with it?

Thanks!

Hi

Having lots of RecastMeshObj components is not a problem usually. In particular if your graph is static and doesn’t change.

Awesome, thanks! And if some of them are dynamic? Would it change much? And what would be the way in this case, should I manually rescan the navmesh or is it internally updated when a dynamic RecastMeshObj is moved/destroyed? Thanks again!

Hi

should I manually rescan the navmesh or is it internally updated when a dynamic RecastMeshObj is moved/destroyed?

It doesn’t do that by itself, so yes. You can also attach the DynamicGridObstacle component (which was intended for grid graphs, but really it works fine with recast graphs too). It will simply recalculate the navmesh if the object moves.

However for dynamic obstacles on navmeshes the NavmeshCut component is usually recommended since it’s (much) faster and more precise. https://arongranberg.com/astar/docs/navmeshcutting.html

1 Like