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