Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Performs a mouse look.
- var horizontalSpeed : float = 2.0;
- var verticalSpeed : float = 2.0;
- var x : float = 0;
- var y : float = 0;
- function Update () {
- // Get the mouse delta. This is not in the range -1...1
- var h : float = horizontalSpeed * Input.GetAxis ("Mouse X");
- var v : float = verticalSpeed * Input.GetAxis ("Mouse Y");
- x = Mathf.Clamp(-30, 30, x+v );
- y = Mathf.Clamp(-90, 90, y+h );
- transform.rotation = Quaternion.Euler(x,y,0);
- }
Advertisement
Add Comment
Please, Sign In to add comment