Improved inventory and reforge camera smoothness

This commit is contained in:
2025-12-24 23:32:58 +01:00
parent 47166c1339
commit d307e2ee6f

View File

@@ -16,6 +16,8 @@ using namespace SDK;
// Constants
const std::string PLUGIN_NAME = "TheCallistoProtocol";
const std::string PLUGIN_LOG = PLUGIN_NAME + ".log";
constexpr float INVENTORY_CAM_OFFSET = 59.16f;
constexpr float FORGE_CAM_OFFSET = 46.f;
// Logger
std::shared_ptr<spdlog::logger> logger;
@@ -407,7 +409,7 @@ static void CameraFixEnabled() {
g_NativeCameraDistance = engineBackDist;
FVector backComponent = backward * engineBackDist;
if (bIsInCinematicMode || bIsInPrinterMode || bIsInventoryOpen || bIsAiming) return;
if (bIsInCinematicMode || bIsAiming) return;
// What we KEEP (height + lateral)
FVector preservedOffset = engineOffset - backComponent;
@@ -504,9 +506,11 @@ static void CameraFixEnabled() {
// sécurité
if (dt <= 0.f || dt > 0.1f) dt = 1.f / 60.f;
float targetOffset = (bIsInventoryOpen || bIsInPrinterMode || bIsInCinematicMode || bIsAiming) ?
float targetOffset = (bIsInPrinterMode || bIsInCinematicMode || bIsAiming) ?
g_NativeCameraDistance : // Minimum offset
(float)g_CameraOffset; // User offset
if (bIsInventoryOpen) targetOffset = INVENTORY_CAM_OFFSET;
if (bIsInPrinterMode) targetOffset = FORGE_CAM_OFFSET;
float interpSpeed = (targetOffset < g_TransitionCameraOffset) ? fadeInSpeed : fadeOutSpeed;
g_TransitionCameraOffset = UKismetMathLibrary::FInterpTo(g_TransitionCameraOffset,