Depth of field fixes and camera zoom fixes

This commit is contained in:
2026-09-11 23:19:03 +02:00
parent d72a9c957a
commit 6240f501ad
6 changed files with 25 additions and 12 deletions

View File

@@ -174,7 +174,7 @@ r.VolumetricFog.GridPixelSize=16
r.PathTracing=False r.PathTracing=False
r.Shadow.Virtual.Enable=0 r.Shadow.Virtual.Enable=0
r.Velocity.EnableVertexDeformation=1 r.Velocity.EnableVertexDeformation=1
r.DepthOfFieldQuality=0 r.DepthOfFieldQuality=1
r.AmbientOcclusion.Compute= 3 r.AmbientOcclusion.Compute= 3
r.VelocityOutputPass=1 r.VelocityOutputPass=1

View File

@@ -18,6 +18,7 @@ struct FArrayOfItemRefs
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY()
TArray<UItemDataAsset*> ItemArray; TArray<UItemDataAsset*> ItemArray;
void SortByName(); void SortByName();

View File

@@ -6,6 +6,7 @@
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
#include "EleriSaveGame.h" #include "EleriSaveGame.h"
#include "EleriGameInstance.h" #include "EleriGameInstance.h"
#include "LTweenBPLibrary.h"
#include "PaperFlipbookComponent.h" #include "PaperFlipbookComponent.h"
#include "Kismet/KismetMathLibrary.h" #include "Kismet/KismetMathLibrary.h"
#include "../GameObjects/WaterBall.h" #include "../GameObjects/WaterBall.h"
@@ -123,12 +124,12 @@ void AMyCharacter::Tick(float DeltaTime)
{ {
Super::Tick(DeltaTime); Super::Tick(DeltaTime);
if (CurrentZoomTimer > 0.f) { // if (CurrentZoomTimer > 0.f) {
const float ZoomDelta = (NextZoomOffsetTarget * DeltaTime) / ZoomTime; // const float ZoomDelta = (NextZoomOffsetTarget * DeltaTime) / ZoomTime;
SpringArmRef->TargetArmLength += ZoomDelta; // SpringArmRef->TargetArmLength += ZoomDelta;
CurrentZoomTimer -= DeltaTime; // CurrentZoomTimer -= DeltaTime;
UE_LOG(LogTemp, Warning, TEXT("Zooming in: ZoomDelta:%f"), ZoomDelta); // UE_LOG(LogTemp, Warning, TEXT("Zooming in: ZoomDelta:%f"), ZoomDelta);
} // }
} }
void AMyCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason) void AMyCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)
@@ -187,15 +188,23 @@ void AMyCharacter::OnHarvestSeed_Implementation(class UItem* HarvestedItem)
{ {
} }
void AMyCharacter::UpdateCameraZoom(float NewZoom) const
{
SpringArmRef->TargetArmLength = NewZoom;
}
void AMyCharacter::ZoomCamera(float CameraZoomAmount, float Time) void AMyCharacter::ZoomCamera(float CameraZoomAmount, float Time)
{ {
CurrentZoomTimer = Time; CurrentZoomTimer = Time;
ZoomTime = Time; ZoomTime = Time;
NextZoomOffsetTarget = CameraZoomAmount; NextZoomOffsetTarget = CameraZoomAmount;
FLTweenFloatSetterDynamic Setter;
Setter.BindDynamic(this, &AMyCharacter::UpdateCameraZoom);
ULTweenBPLibrary::FloatTo(this, Setter, SpringArmRef->TargetArmLength, SpringArmRef->TargetArmLength + CameraZoomAmount, Time);
} }
void AMyCharacter::ZoomBack(float Time) { void AMyCharacter::ZoomBack(float Time) {
ZoomCamera(SpringArmRef->TargetArmLength - DefaultZoom, Time); ZoomCamera(DefaultZoom - SpringArmRef->TargetArmLength, Time);
} }
void AMyCharacter::ReturnCameraToPlayer() { void AMyCharacter::ReturnCameraToPlayer() {

View File

@@ -33,7 +33,7 @@ public class ProjectEleri : ModuleRules
"InteractionSystem" "InteractionSystem"
}); });
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "OnlineSubsystemUtils", "Landscape" }); PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "OnlineSubsystemUtils", "Landscape", "LTween" });
// Uncomment if you are using Slate UI // Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

View File

@@ -83,6 +83,9 @@ protected:
float ZoomTime = 0.f; float ZoomTime = 0.f;
float NextZoomOffsetTarget = 0.f; float NextZoomOffsetTarget = 0.f;
UFUNCTION()
void UpdateCameraZoom(float NewZoom) const;
static const FText PlayerName; static const FText PlayerName;
//----- ISaveableObjectInterface ----- //----- ISaveableObjectInterface -----