diff --git a/EndlessVendetta/.idea/.idea.EndlessVendetta.dir/.idea/vcs.xml b/EndlessVendetta/.idea/.idea.EndlessVendetta.dir/.idea/vcs.xml new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ b/EndlessVendetta/.idea/.idea.EndlessVendetta.dir/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index e7dcb857..cc246418 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65d9f1286e3e2a0afeb00fd61e2a4ad5d105f8c4ea61cf146761901c810ea4bb -size 42451 +oid sha256:946f8f62bbea4cb4f5d279e9da49d29291bacb30f803de7fd8503ed608295287 +size 42585 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index b5a6daba..4e3a7b0b 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b6a0ba4e4f4c638a319c76ccdd1a71c53a5f6a04822a0f6a18861e5f44d2eb51 -size 37876 +oid sha256:3194a5d00e86f1294c85008ba95e40c7d09358e3df2d8360945f78a20dc0a78d +size 37917 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset index 423c7283..e0afe7ed 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WeaonRecoil/AssaultRecoilPattern.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b63c754fc78a67f950a91e30dd31a6778bac31a485191b9cc14560515d5012a5 +oid sha256:136afa1f1b4d7d302c0824edcbaeff1061de8ca41532af1ff390294a8baeda7a size 2033 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset index bdd28701..b36651a3 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/WBP_Crosshair.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a3c0a70c5b68ec66372ae8e29abcb76deb385319f24202e43395c9061b3d0f8a -size 24854 +oid sha256:f29a879021fde175da0f45dcffaa1e4b4765574bb429977dc552cd51b2ad899a +size 24819 diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 96a6656e..a8f66c9c 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -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()); diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index 933b5a2c..19175cef 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -119,6 +119,8 @@ public: FVector newTraceEnd; FCollisionQueryParams collisionParams; + FRotator ogPlayerRotation; + //UFUNCTION(BlueprintCallable, Category = "Weapons") //void RecoilVerticalLimit(FHitResult Outhit);