How would I disable diagonal movement? 4 way directional movement like an NES game

Well… You’ll have to make it so that you can only move in one direction at a time. The easiest way to do that is probably adjusting the input so only one input key can be read at a time, and if the currently pressed input key is not the same as the last one, stop all movement immediately to prevent accidental diagonal movement.

I’ll provide you an example of this tomorrow if nobody else beats me to it.

This will do for your purposes:

You need to unhook the camera controls, because as the basic character is configured, the forward movement direction is controlled by the controller that’s also used to control the camera, by removing the camera controls entirely you make it so that the forward and backwards direction are always consistently the same.

For the movement you add a simple check (the branch) to see which axis the character should move on based on what input key is being pressed.

This is how it looks.

I decided to skip the step to stop all movement if the last movement key isn’t the same as the current one because it seemed unnecessary for your purposes (so basically a tiny bit of diagonal movement is still possible, but it’s so small the player won’t really perceive it.

If you still want to be able to move the camera independently, you can unhook that from the pawn controller.

In the camera boom configure like this:

This makes camera and pawn rotation completely independent (if you would now hook the camera controls back in, in the above blueprint, it would allow you to control the characters movement direction like an analogue stick without affecting the camera facing direction)

You can then use add relative rotation to control the camera, for instance if you want to be able to control only the pitch of the camera (so you can look up and down only) you can do this:

Hello there,

I need something similar, 4-ways only. I have already implemented something with Blueprints, something looking like the solution proposed by @Cestarian. It works great.

My player moves as I want to. Now the question, how should I apply the same movement algorithm to my AI controllers? They also need to move 4-ways, same rules for everyone!

How to override AI movements, triggered by a “AI MoveTo” node or a “Move To” node from my behavior tree? As all the characters will move the same ways, I want to define that globally, if possible.

I am new to UE and I would like to learn how to do things, and do them right :wink: