-2

I am trying to lerp from rotation one to another. The another rotation is constitute using this

 Quaternion qNew = Quaternion.Euler(new Vector3(navigationCanvas.transform.rotation.x, navigationCanvas.transform.rotation.y, camRotationToWatch.transform.rotation.z)); 

The new rotation where I have to lerp is given above, Is this right? cause its is not doing what i meant while i am lerping like this

 navigationCanvas.transform.rotation = Quaternion.Lerp(navigationCanvas.transform.rotation, qNew, Time.deltaTime * 2f);
Muhammad Faizan Khan
  • 10,013
  • 18
  • 97
  • 186

1 Answers1

2

By default, Unity uses quaternion to express rotation so as to prevent gimbal lock, thus transform.rotation is already a quaternion :

Transform.rotation

Description

The rotation of the transform in world space stored as a Quaternion.

You have to use the eulerAngles property instead :

Quaternion qNew = Quaternion.Euler( new Vector3(
    navigationCanvas.transform.eulerAngles.x,
    navigationCanvas.transform.eulerAngles.y,
    camRotationToWatch.transform.eulerAngles.z
));
Community
  • 1
  • 1
Hellium
  • 7,206
  • 2
  • 19
  • 49