Tweaked AR Recoil Vals and Added Moving Error to all weapons
This commit is contained in:
parent
cd38898a58
commit
13d96ad67c
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3194a5d00e86f1294c85008ba95e40c7d09358e3df2d8360945f78a20dc0a78d
|
||||
size 37917
|
||||
oid sha256:d4914d01f2581bf5c3edc200811e9990ccc825755171a4fc83bfb0ef12bcb145
|
||||
size 38083
|
||||
|
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset
(Stored with Git LFS)
Binary file not shown.
@ -75,7 +75,11 @@ void ABaseWeaponClass::GenerateRecoilVector()
|
||||
|
||||
recoilResultYaw = FMath::Sin(FMath::DegreesToRadians(angle));
|
||||
recoilResultPitch = FMath::Cos(FMath::DegreesToRadians(angle));
|
||||
|
||||
|
||||
if (bulletCountShoot >= howMnyShotsTillRclStop)
|
||||
{
|
||||
recoilResultPitch = 0;
|
||||
}
|
||||
//scaling direction to magnitude
|
||||
recoilResultPitch *= -tempMag;
|
||||
recoilResultYaw *= tempMag;
|
||||
@ -92,9 +96,7 @@ void ABaseWeaponClass::ApplyRecoil(float DeltaTime)
|
||||
recoilTime += DeltaTime;
|
||||
if (bulletCountShoot <= 3) playerInWorld->AddControllerPitchInput(GetRecoilPitch(amplitude, recoilTime));
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -155,24 +157,20 @@ void ABaseWeaponClass::Fire()
|
||||
//do damage fallof based off distance
|
||||
traceStart = GunStartArrow->GetComponentLocation();
|
||||
traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance);
|
||||
/*RecoilVerticalLimit(outHit);*/
|
||||
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);
|
||||
DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 1.5f);
|
||||
playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1);
|
||||
currentAmmoCount -= 1;
|
||||
UE_LOG(LogTemp, Display, TEXT("Ammo Count: %d"), currentAmmoCount);
|
||||
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());
|
||||
if (!Cast<AAICharacter>(outHit.GetActor())) return;
|
||||
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(WeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
||||
}
|
||||
@ -188,10 +186,10 @@ void ABaseWeaponClass::WeaponScopedFire()
|
||||
{
|
||||
if (endlessVendettaChar->bIsScoped)
|
||||
{
|
||||
recoilMagnitude -= 0.2f;
|
||||
recoilMaxAngleLeft /= 2.f;
|
||||
recoilMaxAngleRight /= 2.f;
|
||||
recoilMinMultiplier -= 0.2f;
|
||||
recoilMagnitude = scopedRecoilMag;
|
||||
recoilMaxAngleLeft = scopedMaxAngleLeft;
|
||||
recoilMaxAngleRight = scopedMaxAngleRight;
|
||||
recoilMinMultiplier = scopedMinMultiplier;
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -24,9 +24,9 @@ protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
void GenerateRecoilVector();
|
||||
|
||||
void ApplyRecoil(float DeltaTime);
|
||||
|
||||
void GenerateRecoilVector();
|
||||
|
||||
void nullSamples();
|
||||
|
||||
@ -44,7 +44,7 @@ protected:
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
FName WeaponName;
|
||||
|
||||
@ -57,9 +57,25 @@ public:
|
||||
UPROPERTY(EditAnywhere)
|
||||
int MagazineSize;
|
||||
|
||||
//how many bullets until the recoil stops going up
|
||||
UPROPERTY(EditAnywhere)
|
||||
int howMnyShotsTillRclStop;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
UTexture2D* WeaponImage;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "ScopedFire")
|
||||
float scopedRecoilMag;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "ScopedFire")
|
||||
float scopedMaxAngleLeft;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "ScopedFire")
|
||||
float scopedMaxAngleRight;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "ScopedFire")
|
||||
float scopedMinMultiplier;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Weapons")
|
||||
virtual void Fire();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user