How to restrict enemy AI rotation for a 2.5D game?

I have an enemy AI in my 2.5D project, however I can’t figure out how to restrict the rotation of the AI while it’s roaming/ chasing the player?

(Video example!)

Here is my code in case it’s something I’m doing wrong here :sob:

AI roam code:

AI Chase:

Thanks for any help!!:raising_hands:

One thing that helps is to make the navmesh so narrow the ai has to move in a straight line. In my 2.5D project, the navmesh looks like this:

To do that, just select the navmesh bounds volum and set its width (y for you I think) in brush settings to like 100 or something).

Do you want characters to be able to move off the center axis at all (like a classic beat-em-up?)? Or constrained to a single plane (like a Metroidvania?)?

If you want them to move towards and from the camera a little, might want to tick AllowStrafe in the AI Controller and set the control rotation before every move command.

Or you could just chuck a call to this function in tick on your paper pawns:

Adjust selected rotations as needed depending on which way is left and right for you and your pawns. Feed it the delta time pin from tick, or explicitly get world delta seconds inside func. Prolly need to untick the options in char move comp to use control rotation or orient to movement tho so they don’t fight.