WASD movement with 45 degree offset

Hi everyone, I have a simple question about setting up the movement. I’m using basic blueprint for thirdperson template (UE 5.4). By default it works fine with WASD movement. But when I rotate the SpringArm along the Z (Up) axis by 45 degrees, a problem arises. In my project I am using a top-down view, the camera is fixed. It is logical that when you press W, the character goes up by the coordinates, but visually to the right and up. Just in case, I will duplicate this in the pictures. Also, with a keyboard shortcut, WD for example, the character actually moves diagonally, but visually to the right. I don’t want to disable the keyboard shortcut, but to “shift” their direction in the same way as WASD.
So all I need is to offset the movement by 45 degrees. I’m new to programming and blueprinting, which makes it challenging. Motion control works along the X and Y axes. But I don’t yet understand how to set the W key to move along the vector (1, 1). At the same time, it is important for me not to break the operation of the keyboard shortcuts.
I would be very grateful for any help, for example, where to look for information on this topic


1 Like

Open the character class and Rotate the Mesh 45 degrees.

Hmm, but this will only change the angle of the mesh with animations. Movement directions remains the same. You mean this parameter, right?

the default template character works like your 2nd picture,if you didn’t modify it.

1 Like

Like I said, Spring Arm was turned on 45 degrees by Z. Camera is fixed. This is necessary in my project. So, that’s why default movement doesn’t work correct now. And I need to fix it

you can replace the control rotation with camera rotation.

1 Like

Unfortunately, I didn’t get the idea( It’s not about controller desired rotation / orient rotation to movement?
But I guess too that this can be solved using a camera. By default, I disable any camera rotation (picture 1). But if I turn it on and leave orient rotation to movement turned on, I can rotate the character in the game with the mouse 45 degrees while moving, and after that it will move with WASD exactly the way I want. But of course, this is just a test, not a working solution


6

I mean like this:


replace these two control rotation with camera’s rotation.

by default it uses the control rotation to determine the character’s walking direction.

control rotation is basically = camera’s rotation.

but once the spring arm get rid of control rotation.their directions no longer equal.

so it can be fixed by using camera’s rotation ,because the camera always looks at the character.

and the left,right,up and down of the screen are the same with camera’s.

2 Likes

Wow, it works! I understood the principle, but I couldn’t write it into the blueprint. Apparently I really need to learn the basics of BP. Thank you friend, you helped me a lot :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.