From 733f10bfe04b1b84783134a310e9a76b93e1e09d Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Wed, 15 Jan 2020 18:57:42 -0500 Subject: [PATCH] Fixed camera limit snapping issue --- Assets/Scripts/CameraController.cs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/CameraController.cs b/Assets/Scripts/CameraController.cs index 6fba5b9..6f93646 100644 --- a/Assets/Scripts/CameraController.cs +++ b/Assets/Scripts/CameraController.cs @@ -36,33 +36,20 @@ public class CameraController : MonoBehaviour pivot.Rotate(-camY, 0, 0); } - if(Input.GetKey(KeyCode.LeftShift)) - { - player.Rotate(0, camX, 0); - pivot.Rotate(0, 0, 0); - } - if(pivot.rotation.eulerAngles.x > maxViewAngle && pivot.rotation.eulerAngles.x < 180f) { - pivot.rotation = Quaternion.Euler(maxViewAngle, 0, 0); + pivot.rotation = Quaternion.Euler(maxViewAngle, pivot.rotation.eulerAngles.y, pivot.rotation.eulerAngles.z); } if(pivot.rotation.eulerAngles.x > 180f && pivot.rotation.eulerAngles.x < (360 + minViewAngle)) { - pivot.rotation = Quaternion.Euler(minViewAngle, 0, 0); + pivot.rotation = Quaternion.Euler(minViewAngle, pivot.rotation.eulerAngles.y, pivot.rotation.eulerAngles.z); } float camZ = Input.GetAxisRaw("Mouse ScrollWheel"); float angleY = pivot.eulerAngles.y; float angleX = pivot.eulerAngles.x; - /* Code to force the camera behind the player - if(Input.GetKey(KeyCode.LeftShift)) - { - angleY = player.eulerAngles.y; - angleX = player.eulerAngles.x; - } */ - float cameraAngle = transform.eulerAngles.y; Quaternion rotation = Quaternion.Euler(angleX, angleY, 0);