From d7f80fdb1baa1f324b808293d778fa9160b512a8 Mon Sep 17 00:00:00 2001 From: Antoine Lelievre Date: Thu, 8 Apr 2021 11:21:41 +0200 Subject: [PATCH 1/6] Fixed the camera controller in the template with the old input system. --- .../SampleSceneAssets/Scripts/SimpleCameraController.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs b/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs index 231bb20c3d0..557f8245f53 100644 --- a/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs +++ b/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs @@ -225,7 +225,6 @@ void Update() float GetBoostFactor() { #if ENABLE_INPUT_SYSTEM - // TODO return boostFactorAction.ReadValue().y * 0.01f; #else return Input.mouseScrollDelta.y * 0.01f; @@ -237,7 +236,7 @@ Vector2 GetInputLookRotation() #if ENABLE_INPUT_SYSTEM return lookAction.ReadValue(); #else - return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1)); + return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1)) * 10.0f; // try to compensate the diff between the two input systems #endif } @@ -268,7 +267,7 @@ bool IsCameraRotationAllowed() canRotate |= Gamepad.current != null ? Gamepad.current.rightStick.ReadValue().magnitude > 0 : false; return canRotate; #else - return Input.GetMouseButtonDown(1); + return Input.GetMouseButton(1); #endif } From 4c5316b2336e0111289bca62b3fca2005ae3a4b8 Mon Sep 17 00:00:00 2001 From: Antoine Lelievre Date: Thu, 8 Apr 2021 11:22:05 +0200 Subject: [PATCH 2/6] Updated changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index fd3bbfe3786..2127209a2a6 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -136,6 +136,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed volumetric fog being visually chopped or missing when using hardware Dynamic Resolution Scaling. - Fixed generation of the packed depth pyramid when hardware Dynamic Resolution Scaling is enabled. - Fixed Decal's UV edit mode with negative UV +- Fixed the camera controller in the template with the old input system. ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard From e5189e2de0cd3592b0cc7d3e9fc03daaea5abc17 Mon Sep 17 00:00:00 2001 From: Antoine Lelievre Date: Thu, 8 Apr 2021 11:36:29 +0200 Subject: [PATCH 3/6] Adjust values between two systems --- .../SampleSceneAssets/Scripts/SimpleCameraController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs b/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs index 557f8245f53..d3bd62c889e 100644 --- a/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs +++ b/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs @@ -233,10 +233,11 @@ float GetBoostFactor() Vector2 GetInputLookRotation() { + // try to compensate the diff between the two input systems by multiplying with empirical values #if ENABLE_INPUT_SYSTEM - return lookAction.ReadValue(); + return lookAction.ReadValue() * 0.7f; #else - return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1)) * 10.0f; // try to compensate the diff between the two input systems + return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1)) * 10.0f; #endif } From 01990d44fd25a65779096f5187f4b5e7cb4242a7 Mon Sep 17 00:00:00 2001 From: Antoine Lelievre Date: Thu, 8 Apr 2021 12:05:31 +0200 Subject: [PATCH 4/6] Fix difference between delta of two input systems --- .../Scripts/SimpleCameraController.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs b/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs index d3bd62c889e..0ee8fd9e044 100644 --- a/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs +++ b/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs @@ -65,6 +65,9 @@ public void UpdateTransform(Transform t) public float positionLerpTime = 0.2f; [Header("Rotation Settings")] + [Tooltip("Multiplier for the sensitivity of the rotation.")] + public float mouseSensitivity = 10.0f; + [Tooltip("X = Change in mouse position.\nY = Multiplicative factor for camera rotation.")] public AnimationCurve mouseSensitivityCurve = new AnimationCurve(new Keyframe(0f, 0.5f, 0f, 5f), new Keyframe(1f, 2.5f, 0f, 0f)); @@ -188,7 +191,7 @@ void Update() // Rotation if (IsCameraRotationAllowed()) { - var mouseMovement = GetInputLookRotation() * Time.deltaTime * 5; + var mouseMovement = GetInputLookRotation() * Time.deltaTime * 6 * mouseSensitivity; if (invertY) mouseMovement.y = -mouseMovement.y; @@ -235,9 +238,12 @@ Vector2 GetInputLookRotation() { // try to compensate the diff between the two input systems by multiplying with empirical values #if ENABLE_INPUT_SYSTEM - return lookAction.ReadValue() * 0.7f; + var delta = lookAction.ReadValue(); + delta *= 0.5f; // Account for scaling applied directly in Windows code by old input system. + delta *= 0.1f; // Account for sensitivity setting on old Mouse X and Y axes. + return delta; #else - return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1)) * 10.0f; + return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1)); #endif } From e2a35e6624fbfd52441ea80100fd80f1bc8aa8c6 Mon Sep 17 00:00:00 2001 From: Antoine Lelievre Date: Thu, 8 Apr 2021 12:11:46 +0200 Subject: [PATCH 5/6] Updated changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 2127209a2a6..92377606a4d 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -136,7 +136,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed volumetric fog being visually chopped or missing when using hardware Dynamic Resolution Scaling. - Fixed generation of the packed depth pyramid when hardware Dynamic Resolution Scaling is enabled. - Fixed Decal's UV edit mode with negative UV -- Fixed the camera controller in the template with the old input system. +- Fixed the camera controller in the template with the old input system (case 1326816). ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard From 5fe35d1039135c0fb8692a5dd07535ae4139137c Mon Sep 17 00:00:00 2001 From: Antoine Lelievre Date: Thu, 8 Apr 2021 12:30:26 +0200 Subject: [PATCH 6/6] Update SimpleCameraController.cs --- .../SampleSceneAssets/Scripts/SimpleCameraController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs b/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs index 0ee8fd9e044..5bb58871577 100644 --- a/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs +++ b/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs @@ -66,7 +66,7 @@ public void UpdateTransform(Transform t) [Header("Rotation Settings")] [Tooltip("Multiplier for the sensitivity of the rotation.")] - public float mouseSensitivity = 10.0f; + public float mouseSensitivity = 60.0f; [Tooltip("X = Change in mouse position.\nY = Multiplicative factor for camera rotation.")] public AnimationCurve mouseSensitivityCurve = new AnimationCurve(new Keyframe(0f, 0.5f, 0f, 5f), new Keyframe(1f, 2.5f, 0f, 0f)); @@ -191,7 +191,7 @@ void Update() // Rotation if (IsCameraRotationAllowed()) { - var mouseMovement = GetInputLookRotation() * Time.deltaTime * 6 * mouseSensitivity; + var mouseMovement = GetInputLookRotation() * Time.deltaTime * mouseSensitivity; if (invertY) mouseMovement.y = -mouseMovement.y;