Navmesh params to target only hole areas

Hi Folks!

In the playground below I’m navmeshing big landscape scene for movable areas and it works just perfect!

But what if I want go further and create second navmesh with only “lake” zones of this landscape?
What are the proper Recast params to match lowest areas of mesh?

wonder if maybe @Cedric have some suggestions

Navmesh parameters work by allowing more areas. You can allow going to the “lakes” but you can restrain from going on the flat terrain.
To get the lakes geometry, you can use CSG : CSG - Babylon.js Documentation
and substract a box to your terrain to only get the lakes. Then you can compute the navmesh.
beware tho, there is no way to make links between both navmesh.
What’s your use case?

1 Like

Hello @Cedric, and thanks for quick reply.

My usecase:

  • no need for links between navmesh
  • one navmesh will be used for actors navigation
  • second (the lakes one) - to spawn some random events (fountains or whatever) when actor is nearby

Yes, I was thinking about CSG but I’m not sure how to use it properly
In pg below I was able to cut of all “mountain” areas, and target some lake areas.
however CSG substract resulting mesh contains undesired plane geometry, and nawmesh is marking it as source for navigation

I see. Having a second navmesh is a bad idea as it’s not currently supported.
But I have an idea: keep the lakes in the navmesh but inaccessible (tweak climb/slope parameters)
Then, if you want an position on the lake, call getclosestpoint from your character position but below him.
It should return the character position (if no lake nearby) or a position on the lake if any around.
This should work because the lake is below the character.

1 Like

Hi! Brilliant idea and it should work indeed. Thanks for your help

1 Like