From 323516cb13cee0afd020e36fb22d5f3b46321806 Mon Sep 17 00:00:00 2001 From: Gregory Labute Date: Thu, 19 Dec 2024 17:20:37 -0500 Subject: [PATCH] Bugfix: FramingTransposer with a dead zone would sometimes drift --- com.unity.cinemachine/CHANGELOG.md | 1 + .../Runtime/Components/CinemachinePositionComposer.cs | 2 +- .../Runtime/Deprecated/CinemachineFramingTransposer.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/com.unity.cinemachine/CHANGELOG.md b/com.unity.cinemachine/CHANGELOG.md index 26a8e43b6..5de274dd3 100644 --- a/com.unity.cinemachine/CHANGELOG.md +++ b/com.unity.cinemachine/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Bugfixes - CameraDeactivated events were not sent consistently when a blend interrupted another blend before completion. - CameraActivated events were not sent consistently when activation was due to timeline blends. +- Bugfix: FramingTransposer with a dead zone would sometimes drift. ## [3.1.2] - 2024-10-01 diff --git a/com.unity.cinemachine/Runtime/Components/CinemachinePositionComposer.cs b/com.unity.cinemachine/Runtime/Components/CinemachinePositionComposer.cs index abcae257b..e09281d3a 100644 --- a/com.unity.cinemachine/Runtime/Components/CinemachinePositionComposer.cs +++ b/com.unity.cinemachine/Runtime/Components/CinemachinePositionComposer.cs @@ -319,7 +319,7 @@ public override void MutateCameraState(ref CameraState curState, float deltaTime realTargetPos - cameraOffset, hardGuideOrtho); } } - curState.RawPosition = localToWorld * (cameraPos + cameraOffset); + curState.RawPosition = camPosWorld + localToWorld * cameraOffset; m_PreviousCameraPosition = curState.RawPosition; m_InheritingPosition = false; diff --git a/com.unity.cinemachine/Runtime/Deprecated/CinemachineFramingTransposer.cs b/com.unity.cinemachine/Runtime/Deprecated/CinemachineFramingTransposer.cs index 50ee58e41..59c58388e 100644 --- a/com.unity.cinemachine/Runtime/Deprecated/CinemachineFramingTransposer.cs +++ b/com.unity.cinemachine/Runtime/Deprecated/CinemachineFramingTransposer.cs @@ -549,7 +549,7 @@ public override void MutateCameraState(ref CameraState curState, float deltaTime realTargetPos - cameraOffset, hardGuideOrtho); } } - curState.RawPosition = localToWorld * (cameraPos + cameraOffset); + curState.RawPosition = camPosWorld + localToWorld * cameraOffset; m_PreviousCameraPosition = curState.RawPosition; // Adjust lens for group framing