fix: fixed projectile flight direction

Shooting ignored vertical rotation of controller. Fixed and simplified code.
This commit is contained in:
Kubson96 2025-04-18 02:04:39 +02:00
parent b7263615c0
commit c9914f14ea

View File

@ -63,11 +63,9 @@ void UShootingComponent::MeleAttack()
} }
AActor* UShootingComponent::ExecuteLineTrace(float LineRange) AActor* UShootingComponent::ExecuteLineTrace(float LineRange)
{ {
FVector ForwardVector = PlayerCharacter->GetActorForwardVector(); FVector ForwardVector = CameraManager->GetActorForwardVector();
FVector ViewLocation; FVector ViewLocation = CameraManager->GetCameraLocation();
FRotator ViewRotation;
PlayerCharacter->GetController()->GetPlayerViewPoint(ViewLocation, ViewRotation);
FVector EndVector = ViewLocation + ForwardVector * LineRange; FVector EndVector = ViewLocation + ForwardVector * LineRange;