# Using Recast nav mesh with stairs

**URL:** <https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402>\
**Category:** Questions\
**Created:** [July 22, 2022, 11:41am UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402 "2022-07-22T11:41:12Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jmidd91](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Jmidd91](https://forum.babylonjs.com/u/Jmidd91)\
**Post date:** [July 22, 2022, 11:41am UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/1 "2022-07-22T11:41:12Z")

</div>

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](https://playground.babylonjs.com/#WCSDE1#95)

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](https://playground.babylonjs.com/#X5XCVT#240) ) 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?

---

<div class="post-metadata">

**Author:** ![Jmidd91](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Jmidd91](https://forum.babylonjs.com/u/Jmidd91)\
**Post date:** [July 22, 2022, 11:41am UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/2 "2022-07-22T11:41:42Z")

</div>

I cant find any Recast demos where it shows what I am looking for, however, I can find a [demo](https://github.com/wanadev/babylon-navigation-mesh) 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)

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 22, 2022, 1:27pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/3 "2022-07-22T13:27:06Z")

</div>

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:

> **[Babylon.js Playground](https://playground.babylonjs.com/#WCSDE1%2396)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 22, 2022, 1:31pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/4 "2022-07-22T13:31:33Z")

</div>

I just did more tweaks:

> **[Babylon.js Playground](https://playground.babylonjs.com/#WCSDE1%2397)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

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

---

<div class="post-metadata">

**Author:** ![Jmidd91](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Jmidd91](https://forum.babylonjs.com/u/Jmidd91)\
**Post date:** [July 22, 2022, 2:00pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/5 "2022-07-22T14:00:57Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 22, 2022, 2:06pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/6 "2022-07-22T14:06:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jmidd91](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Jmidd91](https://forum.babylonjs.com/u/Jmidd91)\
**Post date:** [July 22, 2022, 2:31pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/7 "2022-07-22T14:31:25Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 22, 2022, 2:43pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/8 "2022-07-22T14:43:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jmidd91](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Jmidd91](https://forum.babylonjs.com/u/Jmidd91)\
**Post date:** [July 25, 2022, 9:50am UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/9 "2022-07-25T09:50:13Z")

</div>

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](https://playground.babylonjs.com/#WCSDE1#99)

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 🙂

 ![path](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/8/98a60f5cef8d8b2ed60010dd8b3d5a03682f25cd.jpeg)

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 25, 2022, 10:23am UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/10 "2022-07-25T10:23:23Z")

</div>

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

> **[Babylon.js Playground](https://playground.babylonjs.com/#WCSDE1%23100)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

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.

---

<div class="post-metadata">

**Author:** ![Jmidd91](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Jmidd91](https://forum.babylonjs.com/u/Jmidd91)\
**Post date:** [July 26, 2022, 2:02pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/11 "2022-07-26T14:02:03Z")

</div>

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](https://github.com/wanadev/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!

---

<div class="post-metadata">

**Author:** ![shadowFacts](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@shadowFacts](https://forum.babylonjs.com/u/shadowFacts)\
**Post date:** [May 20, 2024, 4:33pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/12 "2024-05-20T16:33:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [May 20, 2024, 4:38pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/13 "2024-05-20T16:38:41Z")

</div>

Did you check this PG?

> **[Babylon.js Playground](https://playground.babylonjs.com/#WCSDE1%23100)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![shadowFacts](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@shadowFacts](https://forum.babylonjs.com/u/shadowFacts)\
**Post date:** [May 20, 2024, 4:42pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/15 "2024-05-20T16:42:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [May 21, 2024, 12:53pm UTC](https://forum.babylonjs.com/t/using-recast-nav-mesh-with-stairs/32402/16 "2024-05-21T12:53:57Z")

</div>

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.
