From e8d41797b037778ac69a97217b3028f9848045ba Mon Sep 17 00:00:00 2001 From: Louis Hobbs Date: Wed, 21 Jun 2023 23:08:06 +0100 Subject: [PATCH] Remove Z-aim lock from player aiming --- Source/Nakatomi/PlayerCharacter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index 67fa85e..5e3dc5c 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -224,13 +224,13 @@ void APlayerCharacter::CalculateHits(TArray* hits) const float Spread = CurrentWeapon->GetWeaponProperties()->WeaponSpread; const float Range = CurrentWeapon->GetWeaponProperties()->ProjectileRange; + // TODO: have this start from the end point of the weapon rather than character center // Calculate starting position and direction FVector TraceStart; FRotator PlayerRot; GetController()->GetPlayerViewPoint(TraceStart, PlayerRot); TraceStart = GetRootComponent()->GetComponentLocation(); FVector AimDir = PlayerRot.Vector(); - AimDir.Z = 0.0; TraceStart = TraceStart + AimDir * ((GetInstigator()->GetActorLocation() - TraceStart) | AimDir); // Calculate the hit results from the trace