Navmesh generated but not visible (debug on)

Me again :slight_smile: I’ve been trying a lot of stuff in BabylonJS and liking it a lot!
Now I’m trying to get a navmesh to show up so I can tweak it with terrain generated from a heightmap.
I messed around with the parameters to get recast to actually give me ‘done’ in the console, based on information from older topics.
I added code to show the navmesh, but nothing shows up. Can anyone help me getting the navmesh to be visible so it can be tweaked? Or am I messing something up?

Playground:
https://playground.babylonjs.com/#FUN65H#1

Hi @Censor ,

The first reason it doesn’t work is that ground mesh creation is async. so the ground mesh is not yet ready when you create the navmesh. Initializing the navmesh in the onReady would solve the first issue:

Navmesh not visible | Babylon.js Playground

I will let @Cedric comment regarding the navmesh itself

1 Like

Yes, @RaananW is right. the creation is async and you have to create the navmesh once it’s ready like in this PG:
groundtexture + navmesh | Babylon.js Playground
Also, take care of the values. a cs or ch that is too small compared to your terrain size will prevent the nav mesh creation because it would need too much memory.

2 Likes

Thank you both for replying, I got it working now!
Made function async as RaananW said, and changed cs and ch values to make it show up without error.

1 Like