fix: improved recoil
Recoil now based on camera move instead of applying forces on player character
This commit is contained in:
parent
0f2fac10bd
commit
c26dcd6eae
|
|
@ -51,8 +51,11 @@ void UShootingComponent::Shoot()
|
|||
PlayerCharacter->GetWorldTimerManager().SetTimer(ShootCooldownTimer, this, &UShootingComponent::ResetFireCooldown, FireRateCooldown, false);
|
||||
|
||||
// Odrzut
|
||||
FVector RecoilDirection = -PlayerCharacter->GetActorForwardVector();
|
||||
PlayerCharacter->LaunchCharacter(RecoilDirection * RecoilForce, true, false);
|
||||
float RecoilPitch = FMath::RandRange(-1.0f, -0.5f);
|
||||
float RecoilYaw = FMath::RandRange(-0.5f, 0.5f);
|
||||
|
||||
PlayerCharacter->AddControllerPitchInput(RecoilPitch * RecoilForceMultiplier);
|
||||
PlayerCharacter->AddControllerYawInput(RecoilYaw * RecoilForceMultiplier);
|
||||
|
||||
// DEBUG
|
||||
if (bShowDebugLine)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
float FireRateCooldown = 1.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Shooting")
|
||||
float RecoilForce = 50.0f;
|
||||
float RecoilForceMultiplier = 1.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Shooting")
|
||||
float ReloadTime = 3.0f;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user