Skip to content

Instantly share code, notes, and snippets.

@seferciogluecce
Last active August 17, 2021 15:22
Show Gist options
  • Save seferciogluecce/32c468b4392393f4f394a33a4a3e3c6a to your computer and use it in GitHub Desktop.
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
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