How does UE4 handle (input-based) character rotation by default - or: what is the common approach to deal with character rotation?
I guess yaw is pretty straight forward. It’s probably just the root component being rotated. But what about pitch? If I call “AddControllerPitchInput(Val);” on a character, something happens that rotates the camera attached to it, but obviously the character mesh itself is not rotating.
So I’m wondering what values are responsible here and where they are stored. Is there some kind of pitch-variable on a character that somehow only affects looking/aiming etc?
The “AddControllerPitchInput”-Function ultimately sets an FRotator-Variable inside the Character’s PlayerController called “RotationInput.Pitch”
You could set the Characters “UseControllerRotationPitch”-Variable to true to make the character rotate instead of the camera and set the “InheritPitch”-Variable of the Camera Boom to true to make the camera follow the characters pitch … if that is what you are aiming for?
I guess what I am aiming for is to understand what’s going on in the background and find the “cleanest” way to deal with input, without using any redundant variables, and then write an “open” and flexible approach to allow controlling all different kinds of pawns and characters with a single controller class (probably via input-interface-functions).
Does the RotationInput accumulate input or does it get reset every tick or call? I mean, is it an actual rotation or just a “delta-rotation”?
I just want to understand this, so I can code a good system right from the start.
Thanks again for looking that up. I didn’t even think of the fact that the entire source code is available. I’m still very new to UE.
Interesting, so Pawn::AddControllerPitchInput(Val) doesn’t actually do anything with the pawn itself, only the controller.
Why do you think RotationInput is a delta? I can be wrong, but doesn’t it look like on every update (AddPitchInput) it accumulates “Val * InputPitchScale” (<- delta?) on top of the existing rotation, making it absolute?