Custom Pathfinding

Hi all, I did a custom pathfinding script instead of using any kind of navmeshing, because I eventually want this to work with generated terrain (I therefore can’t bake the navmesh at runtime).

It’s mostly working, but I’m trying to work out a solution to the AI/Actor getting stuck - see pic for example, the middle line is the intended direction of travel, and how its stuck on the corner.
The pathfinding uses a bunch of raycasts, for simplicity I’ll describe it as “left to right”, “bottom to top” for checking the steepness. Another situation where it might get stuck is on “steps” where the raycasts happen to only hit the flat part of the steps and therefore thinks it is flat.

Does anyone have an elegant solution for this, or a more elegant solution altogether?