Last active
August 17, 2021 15:22
-
-
Save seferciogluecce/32c468b4392393f4f394a33a4a3e3c6a to your computer and use it in GitHub Desktop.
How To Rotate Camera In X Y Axes In Unity With Mouse Press | Unity 3D Tutorial at https://youtu.be/FIiKuP-9KuY
This file contains 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 characters
using UnityEngine; | |
public class RotateWithMouse : MonoBehaviour | |
{ | |
public float Speed = 5; | |
void Update() | |
{ | |
if(Input.GetMouseButton(0)) | |
{ | |
transform.eulerAngles += Speed * new Vector3( -Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"),0) ; | |
//transform.Rotate(transform.up ,-Input.GetAxis("Mouse X") * Speed ); //1 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment