Using Recast nav mesh with stairs

Hi!!

I am creating a level for my work where I have a basic house, 2 floors, 1 stair case, I have done a basic recreation of it using one of the demos here: Playground

now I can get the nav mesh to connect both floors, however as in the demo, If I have the player on the bottom floor, have the door open, then click on a room at the top floor, it just goes to linger about on the floor below where i clicked, now if you turn on a ribbon to debug (as seen here ) you can see that the nav path just suddenly goes vertical to the point i clicked on the upper floor rather than routing around, up the stairs.

Is there something I am doing wrong, or is this a limitation of Recast?

I cant find any Recast demos where it shows what I am looking for, however, I can find a demo using this library where it does successfully navigates stairs (by turning them into a slope which is fine) however, that library seems to be a bit more limited than recast, and recast offers many more features which id like to utilise, so i dont particularly wish to swap.

(sorry for the double post, but I wanted to share this link and as I am a “new user” iI was limited to only 2 links)

1 Like

It’s a matter of carefully setting the navmesh parameters. For example, with smaller ch/cs value, there will be more precision (in balance of more memory used and mroe computation intensity), but you will get more details:

I just did more tweaks:

But, in fine, it’s a matter of tweaks. It’s a bit faster when you know the effect of each parameter.

Thanks for the replies, having a look at your playgrounds, not sure if its something wrong with my pc or browser perhaps? but now the cube doesnt even go up onto the stairs? finding it a bit confusing!

Check the debug navmesh (transparent blue) and find the ‘good’ value for walkableClimb.

okey dokey, ill keep fiddling with the settings.

Do you know of any more examples other than what is linked in the docs?

Many thanks :slight_smile:

no, but I guess you can find some examples on the forum.

Hi,

so ive been looking through the forums etc playing with the settings, but nothing fixes my problem, perhaps i didnt explain it well enough, my issue is not that I cant get the stairs to work, its that the path chosen doesnt even use the stairs, if i click on the stairs, the cube goes to them, but if i click directly onto the floor above, the path is just drawn straight to that floor, it doesnt adjust to keep the actor on the nav mesh, as you can see here

Ive added a pic to explain what I mean, is this still to do with the settings? it feels wrong to me so wanted to be 100% sure.

Many thanks :slight_smile:

Same as earlier, it’s a matter of tweaking and having a good mesh.

For example, here I changed the walkableHeight and walkableClimb. It’s a balance between the possibility for the agent to climb stairs Vs able to ‘jump’ anywhere.

If you have too steep stairs and you set the values to allow the agent to climb them, it will also be able to jump walls.

for me personally, the nav mesh was creating as expected, but the navigation of the crowd seemed wrong.

my solution for now is to use recast to create the nav mesh procedurally, then pass this into babylon-navigation-mesh and use this plugins a* navigation as it gives the exact result I expected.

not saying the issue is with Recast, but I could not get the results I needed in the time I had with only using Recast, on the flip side, I didnt have the time to make my own nav mesh by hand / get the correct programs to make a nav mesh and only use babylon-navigation-mesh, so mashing the two together gave me the needed result, even if it makes my program slower.

perhaps in the future I can figure out Recast or there are updates / tutorials that make it easier, who knows!

Would you be able to post your working example of the navPlugin and multiple floors? Struggling to understand how to get it working with stairs/floors etc

Did you check this PG?

Hi @Cedric, thanks for your feedback, apologies for not getting back to you in time. I did indeed find this example and have been playing around with it, but the navMesh seems to be struggling a little bit in getting up and down the stairs even after tweaking the navMesh parameters. For example, it seems to be struggling to move past the block on the right when clicking on the stairs or 2nd floor.

Yes, unfortunately, there is no better choice than trying parameters until it fits your need. You can have faster iteration time when plugging in a GUI to quickly change parameter values.