Remove Z-aim lock from player aiming

This commit is contained in:
Louis Hobbs 2023-06-21 23:08:06 +01:00
parent 797f4def89
commit e8d41797b0
1 changed files with 1 additions and 1 deletions

View File

@ -224,13 +224,13 @@ void APlayerCharacter::CalculateHits(TArray<FHitResult>* 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<APlayerController>()->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