# Going up and down stairs by Unity3d's NavMesh

*Purpose I want to create a navigation mesh that is optimized for going up and down stairs and stopping.

*Question

I'm making a nav mesh to make a character go up and down stairs.
I'm making a nav mesh that makes a character go up and down stairs, but when the character stops in the middle of a step, his foot floats or his foot gets stuck in the stairs.
I'm having a hard time creating a good path for the nav mesh.
I'm wondering if you have any knowledge on how to bake a nav mesh for ascending and descending stairs.

Please let me know what you know about baking navmeshes for stair climbing and descending, and what pages or ideas I should refer to when implementing stair climbing.
Please let me know what you know about baking a nav mesh for stair climbing.

*Preparation

Create the stairs and the ground in Probuilder so that the nav mesh can be baked.

***Case 1

Bake the nav mesh of the stairs.

Test result.

When ascending and descending the stairs, my feet sink into the ground.
Every time I ascend or descend a flight of stairs, the surrounding scenery wobbles up and down.

***Case 2

Make a board to accompany the stairs.
Bake the nav mesh with the stairs hidden and the slope displayed.

Test result.

When ascending and descending the stairs, the feet do not sink in.
But when I stop at the step, my foot floats away.
The scenery does not wobble because you are running on a board.

***Case 3

I made a board to accompany the stairs.
I want to make the nav mesh of the step part flat.
I want to make the nav mesh of the step part flat, so I'll edit the step part with the Probuilder function.
Instead of a straight slope, lower the knot to create a slope and bake it.

Test result.

There is not much change in the shape of the nav mesh from Case 2.
The phenomenon that the foot lifts off the ground when stopping at the step was not improved.
The scenery is not wobbly because you are running on a board.

***Navigation mesh we want to achieve

***Development environment

Unity2019.4.9f1

***Package used

ProBuilder4.2.3

• Your Nav mesh is never going to perfectly follow the environment (not least because it usually has a far lower poly count). Instead, have a look at Inverse Kinematics [IK]. It's an approach that allows the animations of your model to adapt to the environment around them. Thus, if the foot hits a step while being placed, it stops and the legs/hips readjust accordingly. Commented Jan 29, 2021 at 9:51
• I was able to create a sharp-angled NavMesh by setting the VoxelSize in the Advanced settings of the Navigation window to a very small value. Is it more common to use IK to determine the distance to the feet than to control the path in the mesh? Commented Feb 2, 2021 at 1:06
• Yes, IK is more common for placing feet. Navmeshes are usually relatively low poly as the higher the poly count, the more calculations are required to navigate it. Have a look at the diagram here You'll note there's a single quad for each flight of stairs. [Edit: Or possibly I've misunderstood entirely? ] Commented Feb 2, 2021 at 1:13
• I'm not familiar with IK in Unity, and I'm testing FInalIK from AssetStore, but is there a general method or idea of using IK in Unity to go up and down stairs, such as a sample on some web page?　I'd like to look at it and list the problems. Commented Feb 2, 2021 at 1:41
• re-reading this, I think there may be a more fundamental misunderstanding. Forget the nav mesh entirely for a moment. If you manually walk your character up and down the stairs, do his feet work appropriately? My money's on "no". think of the Nav mesh not as something you walk on but like a magnetic field. As your character moves through it, a compass needle tells them which way to move. It's not for standing on, just knowing which way to go. Commented Feb 11, 2021 at 19:22