Paper 2D - Move in y direction

Hi,

I need to be able to move the character in the y direction as well as x (left and right). The x movement works fine, but the character doesn’t move when I use the same blueprint set up for for y movement. I unchecked Constrain to plane in the CharacterMovementComponent. Not sure what I’m doing wrong.

Did you lock the axis of your character? Or rather what exactly do you mean with the Y axis.

Unreal does not directly support 2D. It is a kind of cheated way. You still have your 3D level, 3D vectors and all of this stuff. If you look from the side on your character who moves just fine in X direction Y would mean the depth. Not up and down but away from the camera or towards the camera. Z is the height which would be equivalent to up and down in a 2D game.

Now if your axis is locked and you try to add movement input towards Y it will just be ignored as the axis is locked and the character shouldn’t move in that direction so the input will be overridden.

The other issue I see is: You only look at the X value when comparing your float in your… character bp I guess? Where you add the movementinput.

Now if you only have Y input it will just be ignored as X is still 0. A super easy fix would be to always add the movement input and only place the rotation behind the compare node.

And one last tip. If you open the “Edit” tab and go under “Project settings” you have a point called “Input”. In there you can create action and axis mappings which create an event you can use in your controller and character. However you can bind as many keys to it as you want and it also allows you to add a key rebinding later in the options :wink:

Cheers

Yep, moving the movementinput fixed it. I looked at that Input thing earlier, just never figured out to add the events for it. Thanks :slight_smile: