Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class Player : MonoBehaviour
- {
- float rotationSpeed = 5;
- float rotationX = 0F;
- float rotationY = 0F;
- void Update()
- {
- rotationX += Input.GetAxis("Mouse X") * rotationSpeed;
- rotationY += Input.GetAxis("Mouse Y") * rotationSpeed;
- rotationY = Mathf.Clamp(rotationY,-90,90);
- xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
- yQuaternion = Quaternion.AngleAxis(rotationY, Vector3.left);
- transform.localRotation = xQuaternion * yQuaternion;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement