From 1845537987cf28bc990170fe32f0a30676c68503 Mon Sep 17 00:00:00 2001 From: Kubson96 <42842162+Kubson96@users.noreply.github.com> Date: Thu, 15 May 2025 19:15:32 +0200 Subject: [PATCH] feat: small camera movements --- .../Private/Characters/Components/ShootingComponent.cpp | 9 +++++++++ .../Exo/Public/Characters/Components/ShootingComponent.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/Source/Exo/Private/Characters/Components/ShootingComponent.cpp b/Source/Exo/Private/Characters/Components/ShootingComponent.cpp index cb483b1..fae5ab7 100644 --- a/Source/Exo/Private/Characters/Components/ShootingComponent.cpp +++ b/Source/Exo/Private/Characters/Components/ShootingComponent.cpp @@ -324,4 +324,13 @@ void UShootingComponent::TickComponent(float DeltaTime, ELevelTick TickType, FAc float CurrentFOV = CameraManager->GetFOVAngle(); float NewFOV = FMath::FInterpTo(CurrentFOV, TargetFOV, DeltaTime, AimingAnimationSpeed); CameraManager->SetFOV(NewFOV); + + BreathingTimer += DeltaTime; + + float PitchOffset = FMath::Sin(2.0f * PI * PitchFrequency * BreathingTimer); + float YawOffset = FMath::Sin(2.0f * PI * YawFrequency * BreathingTimer + YawPhaseOffset); + + // Dodanie inputów + PlayerCharacter->AddControllerPitchInput(PitchOffset * PitchAmplitude); + PlayerCharacter->AddControllerYawInput(YawOffset * YawAmplitude); } diff --git a/Source/Exo/Public/Characters/Components/ShootingComponent.h b/Source/Exo/Public/Characters/Components/ShootingComponent.h index d2576f6..7995b84 100644 --- a/Source/Exo/Public/Characters/Components/ShootingComponent.h +++ b/Source/Exo/Public/Characters/Components/ShootingComponent.h @@ -116,4 +116,13 @@ private: bool bIsFirstGunSelected = true; float MeleDamageValue = 50.f; + + float BreathingTimer = 0.0f; + float PitchFrequency = 0.25f; + float YawFrequency = 0.22f; + + float PitchAmplitude = 0.003f; + float YawAmplitude = 0.002f; + + float YawPhaseOffset = PI / 3.0f; };