SpringArm->AddLocalRotation({ static_cast(RotatePitchAxis * 30.0f * DeltaTime), 0.0f, 0.0f });
I am changing the local Pitch rotation, but afterwards I wish to make sure the pitch clamps between a minimum value and maximum value. I tried clamping the relative rotation as follows, but this messes up yaw and roll. I only want to make sure the Pitch stays between two values and not touch the yaw and roll.
auto Rotation = SpringArm->GetComponentRotation();
Rotation.Pitch = FMath::Clamp(Rotation.Pitch, SpringArmMinPitch, SpringArmMaxPitch);
SpringArm->SetRelativeRotation(Rotation);
Does anyone have a suggestions on clamping the pitch?