Last active
February 26, 2024 16:51
-
-
Save marcusx2/8563e00d6fec2ecb69b2f8d6dd8d2435 to your computer and use it in GitHub Desktop.
Revisions
-
marcusx2 renamed this gist
Sep 8, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
marcusx2 revised this gist
Aug 25, 2020 . No changes.There are no files selected for viewing
-
marcusx2 renamed this gist
Aug 25, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
marcusx2 created this gist
Aug 25, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; public class FreeCamera : MonoBehaviour { public float sensitivity = 10f; public float maxYAngle = 80f; private Vector2 currentRotation; void Update() { currentRotation.x += Input.GetAxis("Mouse X") * sensitivity; currentRotation.y -= Input.GetAxis("Mouse Y") * sensitivity; currentRotation.x = Mathf.Repeat(currentRotation.x, 360); currentRotation.y = Mathf.Clamp(currentRotation.y, -maxYAngle, maxYAngle); Camera.main.transform.rotation = Quaternion.Euler(currentRotation.y,currentRotation.x,0); if (Input.GetMouseButtonDown(0)) Cursor.lockState = CursorLockMode.Locked; } }