Hi everyone!
Trying to implement WoW like In Place character rotation that’s depending on Camera angle. I’m using independent Camera and Character rotation, input handles like this:
const float Input = Value.Get<float>();
if (CameraBoom != nullptr && Input != 0.f)
{
FRotator Rotation = CameraBoom -> GetComponentRotation();
Rotation.Add(0.f, Input, 0.f);
CameraBoom -> SetWorldRotation(Rotation);
}
In another script I calculate an angle between Camera and Character in tick:
FRotator CameraRot = BaseCharacter -> GetSpringArmComponent() -> GetComponentRotation();
FRotator PlayerRot = BaseCharacter -> GetActorRotation();
FRotator Angle = FRotator(PlayerRot.Pitch, CameraRot.Yaw - PlayerRot.Yaw, PlayerRot.Roll);
So if difference in Angle.Yaw > 25.f I rotate right, if Angle.Yaw < -25.f I rotate left.
The question is how to handle calculation when camera reaches 180 or -180 position on Yaw?
Thanks in advance!