Alternative to Navmesh cut

Hi guys!

I am working in the stable version with Recast graph, using a scene that has a lot of potentially empty props (and also for adding more info, it has at least 2 different floor levels), and also props with a flat top part. This results in a lot of navmesh parts generated inside this props, which has mesh and collider, so you cannot go through them. My first approach was adding the Navmesh cut, but as the scene grows and grows in props, this is very tedious and takes a lot of time. My second approach was using the tags or layers to prevent the top part of my props to be considered walkable. The bad thing about this is that the graph now doesn’t consider the prop as a obstacle, and creates more navmesh below it.

So, my question is, is there any way to have by default a navmesh generation behaviour that removes the inner part of any collider, even if the collider itself is not occuppying all the space inside. I am not sure if I am explaining good enough xD. Just picture a 3d ring, with a collider that it’s only around the ring shape. If I put it in the ground, I want the navmesh to be completely cutted inside the ring, not only where the ring collider exists, is there any way to achieve this without using the navmesh cut? And also, not making possible the ring to be walkable on its upper surface (just imagine the ring is big enough to hold a person)? I hope that example makes it easier to understand hehe.

Thanks!

Hi

Yes, a solution to this is to upgrade to the beta version.
In the beta version all colliders (except non-convex mesh colliders) are solid and will not have a navmesh generated inside of them.

Even if the inside of the collider is hollow? I mean, like the example in the post, imagine a doughnut as big as a human being placed in the floor. The empty inner part (where you could put your finger in a real doughnut xD), will be free of navmesh generation also? Or just the real volume that occuppies the shape?

Thanks a lot for answering!

It will fill the inside of all convex colliders. There is no built-in unity collider which is a doughnut.

If you are using a mesh collider for it then you could make it convex which would fill the empty inner part as well. Or you could leave it non-convex which will make it not fill the inside at all.

You can also leave it non-convex and attach a RecastMeshObj component and set the ‘solid’ option on that component. That will make it try to fill it by checking the minimum and maximum y coordinate in each voxel pillar and filling everything in that range. In your particular case it would just fill the doughnut and not the inner part.
This mode is not the recommended mode because colliders are not necessarily closed, so even defining an ‘inside’ and ‘outside’ is hard for arbitrary mesh colliders.

I am using mesh colliders yes, but until now I was using the recast graph based on meshes, instead of colliders. I will switch to that approach of using convex colliders. Anyway, for making a surface unwalkable, like the roof of a building or something like this, is it bad to add the RecastMeshObj and set it to unwalkable then? Or what you mean that is bad is just doing that for filling the colliders?

Thanks again :smiley:

Yes. It’s not bad per se, but the behavior might not be what you want in all cases.

Okay got it, but for just making an object non walkable is still a good option, right?

Yes, it’s a good option for that.

Perfect then, thanks a lot for the help!