TLDR: I’m trying to figure out a way to convert the yaw format of Get Actor Rotation (+/- 180) to the yaw format of Get Control Rotation (0 to 360). Ideas please?
Here’s my simple setup for my player Character’s Spring Arm/Camera. When triggered, the camera lerps between a directly behind view (with Roll/Pitch/Yaw), and slightly above and behind view (lifted up by a Spring Arm Target Offset, and only on Yaw).
For the purposes of my game, it works well. In the directly behind, yaw-only mode. So, if the player goes beyond pitch +/-90, the plane flies directly towards the camera and this is what I’m looking for.
So what’s the issue? The thing is, I’m changing my player character from control-driven to physics-driven, so instead of Add Roll/Pitch/Yaw Input and Pawn>Get Control Rotation or Player Controller>Get Control Rotation (which are now zero), I’m using Add Torque.
This is where a quirk of Unreal’s rotators becomes a little awkward. It’s well known that Get Actor Rotation and Get Control Rotation use different value formats, and will give different values when you print them:
Get Control Rotation: Roll (0 to 360), Pitch (0 to 360) and Yaw (0 to 360)
Get Actor Rotation: Roll (+/-180), Pitch (+/-90), and Yaw (+/-180)
Normally, the engine treats these formats identically. It’s not noticable unless they are split. So, now when I split Get Actor Rotation for the above and behind view, there is an awkward new yaw flipping.
So to conclude this vast narrative, I’m trying to figure out a way to convert the yaw format of Get Actor Rotation to the yaw format of Get Control Rotation. Ideas please?