From a0409f6beb9f9358cfc37a5414a7563ec76e2d80 Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Mon, 3 Feb 2020 18:17:50 -0500 Subject: [PATCH] Implemented a fix for the right stick being so slow when playing a build --- Assets/Scripts/CameraController.cs | 22 +++++++++++++++------- ProjectSettings/GraphicsSettings.asset | 1 - ProjectSettings/InputManager.asset | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/CameraController.cs b/Assets/Scripts/CameraController.cs index 6ddbeb4..c9aca9c 100644 --- a/Assets/Scripts/CameraController.cs +++ b/Assets/Scripts/CameraController.cs @@ -26,21 +26,29 @@ public class CameraController : MonoBehaviour void LateUpdate(){ - float camX = 0; - float camY = 0; + float mouseCamX = 0; + float mouseCamY = 0; + float controllerCamX = 0; + float controllerCamY = 0; if(!PauseMenu.GameIsPaused) { - camX = Input.GetAxisRaw("Mouse X") * rotateSpeed; - camY = Input.GetAxisRaw("Mouse Y") * rotateSpeed; + mouseCamX = Input.GetAxisRaw("Mouse X") * rotateSpeed; + mouseCamY = Input.GetAxisRaw("Mouse Y") * rotateSpeed; + + controllerCamX = Input.GetAxisRaw("Right Stick X") * (rotateSpeed * 200.0f) * Time.deltaTime; + controllerCamY = Input.GetAxisRaw("Right Stick Y") * (rotateSpeed * 200.0f) * Time.deltaTime; } - pivot.Rotate(0, camX, 0); + pivot.Rotate(0, mouseCamX, 0); + pivot.Rotate(0, controllerCamX, 0); if (invertY){ - pivot.Rotate(camY, 0, 0); + pivot.Rotate(mouseCamY, 0, 0); + pivot.Rotate(controllerCamY, 0, 0); } else { - pivot.Rotate(-camY, 0, 0); + pivot.Rotate(-mouseCamY, 0, 0); + pivot.Rotate(-controllerCamY, 0, 0); } if(pivot.rotation.eulerAngles.x > maxViewAngle && pivot.rotation.eulerAngles.x < 180f) diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 4a131d8..e04e848 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -38,7 +38,6 @@ GraphicsSettings: - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} - - {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0} m_PreloadedShaders: [] m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index c8946ee..82295ca 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -278,7 +278,7 @@ InputManager: axis: 0 joyNum: 0 - serializedVersion: 3 - m_Name: Mouse X + m_Name: Right Stick X descriptiveName: descriptiveNegativeName: negativeButton: @@ -294,7 +294,7 @@ InputManager: axis: 3 joyNum: 0 - serializedVersion: 3 - m_Name: Mouse Y + m_Name: Right Stick Y descriptiveName: descriptiveNegativeName: negativeButton: