Getting Direction based on Input

Hi,

I need help with calculating the YAW to rotate my character to based on which keys are currently pressed.

Background:

I have a character (Orient rotation to movement) that does a roll animation when pressing Left Shift.

In the code for the LeftShit action Pressed, I need to check which directional keys are pressed at the time of Left Shift being pressed.

I know how to check if a key is pressed, but I don’t know what to do after that. How can I get the Yaw that I need to turn my character to before playing the rolling animation?

Here are some screenshots that help to explain what I’m after:

If somethings not clear, I can post a video or something to better try and explain.

Thanks

You can get the Yaw value like this.

Forward and Right are my axis input names.

263519-0.png

1 Like

Thanks for the reply.

This works as long as the camera is directly behind the character.

If I rotate my camera to in front of the camera, the yaw is the opposite of what it should be so I roll the wrong way.

just add them to the control rotation.

If you’re using a custom camera and not one derived from the controller you can replace GetControlRotation with Camera->GetWorldRotation

2 Likes

After this is done the player’s rotation is reset to its original one, do you know what could be done so it stays facing the same rotation it ends on?

Thanks it worked. You saved my tiny brain from exploding of frustration

Thank you, For you have Helped a man put on a smile in this world