diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index a9bde138bff..4ddd91a85ba 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -148,6 +148,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed camera preview with multi selection (case 1324126). - Fixed a NaN generating in Area light code. - Fix potential NaN on apply distortion pass. +- 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 diff --git a/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs b/com.unity.template-hd/Assets/SampleSceneAssets/Scripts/SimpleCameraController.cs index 231bb20c3d0..5bb58871577 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 = 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)); @@ -188,7 +191,7 @@ void Update() // Rotation if (IsCameraRotationAllowed()) { - var mouseMovement = GetInputLookRotation() * Time.deltaTime * 5; + var mouseMovement = GetInputLookRotation() * Time.deltaTime * mouseSensitivity; if (invertY) mouseMovement.y = -mouseMovement.y; @@ -225,7 +228,6 @@ void Update() float GetBoostFactor() { #if ENABLE_INPUT_SYSTEM - // TODO return boostFactorAction.ReadValue().y * 0.01f; #else return Input.mouseScrollDelta.y * 0.01f; @@ -234,8 +236,12 @@ 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(); + 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)); #endif @@ -268,7 +274,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 }