using UnityEngine;
using System.Collections;
public class CameraRotation : MonoBehaviour {
private float rotationSpeed = 5.0f;
GameObject Person;
GameObject Head;
// Use this for initialization
void Start () {
Person = GameObject.Find("Person");
Head = GameObject.Find("Person/Head");
}
// Update is called once per frame
void Update () {
float mouseX = Input.GetAxis ("Mouse X") * rotationSpeed;
float mouseY = Input.GetAxis ("Mouse Y") * rotationSpeed;
Person.transform.rotation *= Quaternion.Euler(0, mouseX, 0);
Head.transform.rotation *= Quaternion.Euler(-mouseY, 0, 0);
}
}
It works perfectly as expected with no ‘rolling’ of the horizon. And I understand the difference between a rotation relative to a global frame of reference and a rotation relative to a local frame of reference… just not sure why there appears to be no difference between global and local in this case.
If anyone can clarify I’d really appreciate it. Thanks.