From c090c0a37f246b878418acf579033dbd068bc50b Mon Sep 17 00:00:00 2001 From: Kingsmedia Date: Tue, 3 May 2022 23:36:35 +0200 Subject: [PATCH] 57 - Pitch in Multiplayer --- Source/Blaster/Character/BlasterCharacter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Blaster/Character/BlasterCharacter.cpp b/Source/Blaster/Character/BlasterCharacter.cpp index 08f0e9f..dfd5e0c 100644 --- a/Source/Blaster/Character/BlasterCharacter.cpp +++ b/Source/Blaster/Character/BlasterCharacter.cpp @@ -185,6 +185,15 @@ void ABlasterCharacter::AimOffset(float DeltaTime) } AO_Pitch = GetBaseAimRotation().Pitch; + + // Fix pitch/yaw compression + if (AO_Pitch > 90.f && !IsLocallyControlled()) + { + // map pitch from [270, 360) to [-90, 0) + FVector2d InRange(270.f, 360.f); + FVector2d OutRange(-90.f, 0.f); + AO_Pitch = FMath::GetMappedRangeValueClamped(InRange, OutRange, AO_Pitch); + } } void ABlasterCharacter::ServerEquipButtonPressed_Implementation()