I use Unity 5.3.4 and Oculus VR and implement an application in VR envrionment.
I would like to rotate an object slowly using Quaternion
. For example, when I turn my head 180 degrees to the right, the MainCamera turns around 90 degrees.
In Unity, tracked input of Oculus-VR is calculated automatically and return to Quaternion
data.
void Update()
{
transform.localRotation = UnityEngine.VR.InputTracking.GetLocalRotation(UnityEngine.VR.VRNode.CenterEye);;
}
So I will rotate camera using this Quaternion
. But I don't know how to rotate slowly.
I tried to calculate arithmetic operation, e.g. multiplication, division, to Quaternion
. But it's not working
How to calculate Quaternion
?
Just use:
transform.localRotation =Quaternion.Lerp( transform.localRotation, UnityEngine.VR.InputTracking.GetLocalRotation(UnityEngine.VR.VRNode.CenterEye), Time.deltaTime);