Agent won't navigate around geometry corners

I’m building a game that allows the player to build buildings that the NPCs can navigate, and it basically works using a recast graph that recalculates the mesh when I add or remove geometry. The graph calculates correctly, but the pathing fails in some cases:

One of the basic tests I’ve been running is on stairs, which my npc will not navigate up unless they are lined up directly straight with them. So if the path calls for them to approach the stairs, say, from the left, it’ll get to the bottom of the stairs, then hang near the bottom, instead of walking around the small edge, and up the stairs: https://imgur.com/edeb6IB

Similarly if the player builds a block of geometry that’s between the NPC the player, the NPCs plans a path over the block, which is actually correct since the block is low enough, then it hangs indefinitely, just walking forward in the same position against the geometry forever: https://imgur.com/dPMNhKd

In both of those cases the destination is supposed to be reachable, but the NPC never makes it there because it’s hung. I also notice the green path is quite goofy, it’s sort of jagged and goes in a lot of directions, instead of being a clean path to the destination.

If I line up the stairs to be a straight path from the starting point to the stairs, then a straight path from there to the destination, that also works fine.

On the other hand, if the blocks are high enough not to be reachable, the NPC will navigate around the geometry correctly: https://imgur.com/9A1eGnl

What am I doing wrong?

Oh, I’m using a slightly modified ThirdPersonController and RichAI together, I forgot to mention.

Hi

It looks like your ‘maximum climb’ setting on the recast graph is too high. The agent tries to take steps which it cannot take. Try to reduce that a bit.

If you use the RichAI component then don’t bother that the path looks a bit strange, the RichAI component will simplify that for you. It will draw a blue line in the direction it wants to move.

Ah, I thought that might have something to do with it. I suspect it’s out of the scope of the project, but if I wanted it to be that high, I’m not sure what to do. I guess the ThirdPersonController has to know how to handle the step when it finds one? Or is there something in the project that can cause the agent to rise with the mesh when there’s a step up?

Well, you have to set a step size that the agent can actually handle, otherwise things like this will happen.