Add camera transition smoothness

This commit is contained in:
2025-12-26 19:18:25 +01:00
parent d307e2ee6f
commit 8a0dad9b39

View File

@@ -40,6 +40,7 @@ static bool g_WorldTimeDilation_fix_enabled = false;
static int g_AdditionalFOVValue = 0;
static int g_CameraOffset = 0;
static float g_WorldTimeDilationValue = 1.f;
static float g_CameraSmoothnessValue = 3.5f;
static float g_TransitionCameraOffset = 0.f;
static float g_NativeCameraDistance = 80.f;
static float g_LastCameraDeltaTime = 1.f / 60.f; // fallback
@@ -288,6 +289,11 @@ extern "C" __declspec(dllexport) void SetWorldTimeDilation(float timeDilation) {
g_WorldTimeDilationValue = timeDilation;
}
extern "C" __declspec(dllexport) void SetCameraSmoothness(float smoothness) {
g_CameraSmoothnessValue = smoothness;
}
// Getters for Reshade addon call
extern "C" __declspec(dllexport) void GetGameInfos(GameInfos* infos) {
if (!infos) return;
@@ -501,16 +507,16 @@ static void CameraFixEnabled() {
}
float dt = g_LastCameraDeltaTime;
float fadeInSpeed = 3.5f; // Camera speed when it's getting closer
float fadeOutSpeed = 3.5f; // Camera speed when it moves away
float fadeInSpeed = g_CameraSmoothnessValue; // Camera speed when it's getting closer
float fadeOutSpeed = g_CameraSmoothnessValue; // Camera speed when it moves away
// sécurité
if (dt <= 0.f || dt > 0.1f) dt = 1.f / 60.f;
float targetOffset = (bIsInPrinterMode || bIsInCinematicMode || bIsAiming) ?
g_NativeCameraDistance : // Minimum offset
(float)g_CameraOffset; // User offset
float targetOffset = g_CameraOffset;
if (bIsInCinematicMode || bIsAiming) targetOffset = g_NativeCameraDistance;
if (bIsInventoryOpen) targetOffset = INVENTORY_CAM_OFFSET;
if (bIsInPrinterMode) targetOffset = FORGE_CAM_OFFSET;
else if (bIsInPrinterMode) targetOffset = FORGE_CAM_OFFSET;
float interpSpeed = (targetOffset < g_TransitionCameraOffset) ? fadeInSpeed : fadeOutSpeed;
g_TransitionCameraOffset = UKismetMathLibrary::FInterpTo(g_TransitionCameraOffset,