I’m recently working an a lock-on system for a first person game and when it came to actually changing the players rotation I discovered some weird behavior of the ‘Add Controller Yaw Input’ node.
It just never did what I expected so I just detached all the other nodes and put a ‘Add C. Yaw Input’ node right behind the button input for some testing.
Here is what happened:
The actor did a 180 degree rotation. My first conclusion was that, for some reason, the node might rotate the actor half the value
So I tried
As expected the actor rotated 90 degree
But now as I tried
I expected a rotation of 45 degrees but instead the actor rotated -45 degrees (might as well have been 315 degree, can’t say for sure) and when I pressed the button again the actor rotated 135 degree so now it was rotated 90 degree compared to rotation I started with.
It’s a little hard to explain so I’ll put an image below that should explain it better
I tried even more values but the results varied and I honestly don’t understand what’s happening here.
Any ideas or am I just overlooking something obvious?
That doesn’t seem to be the case
When I try values between 0 and 1 there is just some very little movement as you would expect if it would work with an angle, though I need to press the button 36 times to perform a 90 degree rotation when the value is 1. You should think I’d have to press it 90 times
I would guess that the normal output from an input axis is in the range -1.0 - +1.0 which normally plugs straight into the controller yaw.
Whereas you are inputing an angle in degrees.
You might try dividing that angle by 360 to get a value between 0 and 1?
Yeah, just did some testing, there seems to be a ratio applied to the rotation when using add controller yaw input.
However, I did some testing with set control rotation and this seems to work the way you would like.
Well, guess I’ll go with that solution then
Thanks a lot
All of the AddControllerInput functions are multiplied by the PlayerController’s relevant scale value. In your PlayerController, look for the settings InputYawScale, InputPtchScale, and InputRollScale. If you set these all to be 1.0, you’ll get the behaviour you’re looking for.
The rotation mentioned here is mentioned on this page: Add Controller Yaw Input | Unreal Engine Documentation
There is a multiplier set on the controller.