Why doesn't my character turn when moving

I have set up tank controls (w moves forward, s moves backwards and a and d turn left and right). However when I press either w or s together with a or d the character goes straight. In other words when I run forwards of backwards the character doesn’t turn. But when I press a or d when stationary my turning works fine.

I’ve attached screenshot of my blueprint. I’ve paintbrushed some uninteresting parts to make it easier to read:

Basically I have set up an switch_on_int so I can have different turning speed for left and right. The first branches can be ignored, they don’t do anything.

If your character uses a movement component, you have to use its functions to control the movement. The functions are Add Movement Input and Add Controller Yaw Input for the linear movement and rotations respectively.

Your rotation uses SetActorRotation though, which may conflict with how the movement component handles it. You should use Add Controller Yaw Input instead.

Make also sure you check Use Controller Rotation Yaw in the Details panel of your character blueprint.

Thanks for the response!

If I turn on “Use Controller Rotation Yaw” then the character rotates with the camera I think? I don’t want that. I want character that turns with a and d on keyboard and camera is controlled by mouse and each can point to different directions. I’ll check those other things you mentioned next.

Other thing I noticed is that when I walk backwards the character gets jittery but that has probably nothing to do with these things.

It is weird how both the movement forwards/backwards and turning work independently but not at the same time?

What the camera does when you turn depends on how the camera is rigged to your pawn. There are options on the camera spring arm to have it follow or not the pawn’s yaw rotation. Have a look.

As said, stick to the functions provided by the movement component. They do work at the same time. Another thing to check is how you set “Orient Rotation to Movement” inside the movement component.

Thanks for the response again!

I changed everything back to normal instead of trying to experiment. It basically works but not really. When turning when stationary the charcter yaws way too fast. When moving the turning speed is okayish. But it is different when moving and when stationary. All I can do is go to project settings and reduce the scale of the turning inputs from 1.0 to something like 0.05 which for some reason only adjusts the rotation speed when moving???

And I can’t change any of it in blueprint. When stationary it still rotates like 360degrees per second. When pressing w and a/d together the rotation speed is controlled by the axis input scale. For my project it is crucial that I can adjust the turning speed exactly.

Here is how I have now set up my movement. For some reason the multipliers do nothing? Even if the movement node expects a range of -1…1 it should become slower with value of 0.1 instead of 1?

I have set those variables up in the same blueprint like this. I have lots of stuff in that eventbeginplay, maybe I should move some of it elsewhere?

I’d be super glad if for any more help you could give. How do I control rotation speed? Once I get it to work I think I can add all the other fine tuning stuff myself.

Thanks for the response!
(For some reason my response did not get through so I’m writing it again.)

I changed all my stuff to basics:

Now it works but not quite well.

Basically my issue now is that I can not change the rotation speed of the character in blueprint. When stationary the character rotates way too fast and when moving and turning it is lower. I noticed that when I adjusted my axis input scales for a and d in project settings/input (from 1.0 to much smaller values) it changes the rotation speed when moving. But stationary it is too fast and I can’t change it. I really need precise control of the rotation speeds for my project though.

So my questions are:

  1. How do I control the rotation speed of my character?
  2. Why the input scale changes rotation speed only when moving?
  3. Why do my turninig speed variables do not work (LefRotSpeedLeft and -Right)?

In the first pic you can see how I’ve set up the movement. ere you can see how I define those variables I want to use for ration speed:

I should move them to correct place at some point but I want to keep things simple before I move stuff to other blueprints.

You are using the wrong input function for the turn. It should be Add Controller Yaw Input not Add Movement Input, unless you want your character to slide right/left instead of turning.

If I use the add controller yaw my character is turned with my mouse which is not what I want. I want to control the camera view the mouse and the character with keyboard.

Check how your inputs are mapped in Project Settings → Input. This is what determines which keys/device is used for each event. If you want the turn to happen with keys you have to map the turn events to those keys.

Thank you! I feel so stupid now :D. I checked my inputs and you are right. I think there was a duplication for the mouse X there. So … made some changes and I got the character rotation to work now. Seems like it works ok.

I broke my view mouse controls though which I’d guess need to be done differently now because my mouse yaw was previously using the addControllerYaw node.

To rotate your camera view you need to rotate the spring arm. See how this is done in the third person character template.

Any chance you can share your project for me to have a look? Look me up on the Forums (not AnswerHub but the Unreal Engine forum) and send me a private message if you like.

Or on Discord with my nickname.