Updated Weapon Recoil to KeepFiring but Remove Pitch
This commit is contained in:
parent
f427b07bb9
commit
cd38898a58
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b6a0ba4e4f4c638a319c76ccdd1a71c53a5f6a04822a0f6a18861e5f44d2eb51
|
||||
size 37876
|
||||
oid sha256:3194a5d00e86f1294c85008ba95e40c7d09358e3df2d8360945f78a20dc0a78d
|
||||
size 37917
|
||||
|
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset
(Stored with Git LFS)
Binary file not shown.
@ -91,9 +91,8 @@ void ABaseWeaponClass::ApplyRecoil(float DeltaTime)
|
||||
float amplitude = RecoilCurve->GetFloatValue(recoilTime); //get current value of curve in time
|
||||
recoilTime += DeltaTime;
|
||||
if (bulletCountShoot <= 3) playerInWorld->AddControllerPitchInput(GetRecoilPitch(amplitude, recoilTime));
|
||||
newTraceEnd = traceStart + (UKismetMathLibrary::GetForwardVector(playerInWorld->GetControlRotation() * GetRecoilPitch(amplitude, recoilTime)));
|
||||
GetWorld()->LineTraceSingleByChannel(outHit, traceStart, newTraceEnd, ECC_Visibility, collisionParams);
|
||||
UE_LOG(LogTemp, Warning, TEXT("traceEnd: %s"), *traceEnd.ToString());
|
||||
GunStartArrow->AddRelativeRotation(FRotator(-GetRecoilPitch(amplitude, recoilTime), 0, 0));
|
||||
//traceEnd = GunStartArrow->GetComponentLocation() + (GunStartArrow->GetComponentRotation().Pitch * GetRecoilPitch(amplitude, recoilTime));
|
||||
playerInWorld->AddControllerYawInput(GetRecoilYaw(amplitude, recoilTime));
|
||||
//UE_LOG(LogTemp, Warning, TEXT("recoilTime: %f"), recoilTime);
|
||||
UpdateSamples(amplitude, recoilTime);
|
||||
@ -145,6 +144,8 @@ void ABaseWeaponClass::CancelFire()
|
||||
GetWorldTimerManager().ClearTimer(timerHandle);
|
||||
UE_LOG(LogTemp, Display, TEXT("FireCancelled"));
|
||||
bulletCountShoot = 0;
|
||||
GunStartArrow->SetRelativeRotation(FRotator(0,0,0));
|
||||
playerControllerRef->SetControlRotation(ogPlayerRotation);
|
||||
}
|
||||
|
||||
void ABaseWeaponClass::Fire()
|
||||
@ -155,12 +156,8 @@ void ABaseWeaponClass::Fire()
|
||||
traceStart = GunStartArrow->GetComponentLocation();
|
||||
traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance);
|
||||
/*RecoilVerticalLimit(outHit);*/
|
||||
if (GetWorldTimerManager().IsTimerActive(timerHandle))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (bulletCountShoot <= 3) GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams);
|
||||
//Debug line to see where the trace hit
|
||||
if (GetWorldTimerManager().IsTimerActive(timerHandle)) return;
|
||||
GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams);
|
||||
DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 2.5f);
|
||||
playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1);
|
||||
currentAmmoCount -= 1;
|
||||
@ -168,6 +165,11 @@ void ABaseWeaponClass::Fire()
|
||||
GenerateRecoilVector();
|
||||
ClickDetectionTimer();
|
||||
bulletCountShoot += 1;
|
||||
if (bulletCountShoot <= 1)
|
||||
{
|
||||
ogPlayerRotation = FRotator(playerControllerRef->GetControlRotation());
|
||||
UE_LOG(LogTemp, Display, TEXT("FIRST BULLET FIRED: %s"), *ogPlayerRotation.ToString());
|
||||
}
|
||||
if (outHit.bBlockingHit)
|
||||
{
|
||||
UE_LOG(LogTemp, Display, TEXT("Ammo Count: %s"), *outHit.GetActor()->GetName());
|
||||
|
@ -119,6 +119,8 @@ public:
|
||||
FVector newTraceEnd;
|
||||
FCollisionQueryParams collisionParams;
|
||||
|
||||
FRotator ogPlayerRotation;
|
||||
|
||||
//UFUNCTION(BlueprintCallable, Category = "Weapons")
|
||||
//void RecoilVerticalLimit(FHitResult Outhit);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user