Support Forum

How to not create paths under intersecting geometry?

When I create my levels, I have a base ground and I add obstacles or higher grounds on top of that ground.

This means my geometry intersects with the ground it comes in contact with (see gif below)

When I then scan the terrain with the Astar path script I realized I had 2 heights upon which the AI can walk.

But one of them, the lowest of the two, is invalid. I would like this lowest path to not be created.

I’m sure this problem happens to a lot of people so I would like to know what’s done in that type of scenario.
Obviously, I know in this case I could modify the geometry but is there a better workflow ?

This is expected behavior. There is technically no way for the graph generators to know where it shouldn’t put navigation mesh, as it has no concept of levels. And who knows maybe some people do need this data.

Is there a way to remove entire gameobjects from the process (not with physics layers)?

You could always modify the generator. For example objects with a certain tag are also unwalkable etc.


It is not possible out of the box to exclude objects from the scan that otherwise have the correct layer. However you can use the RecastMeshObj component on only those objects that you do want to include. The RecastMeshObj component overrides the layer check and objects with that component will always be included in the scan.

You can also increase the character height setting on the recast graph to make the surfaces inside the objects unwalkable.