Quaternion lerp is not rotating my object to the desired rotation?

I have an object that I am trying to rotate to a certain rotation.
The rotation I want is (0,0,90) that is based n the inspector when I try it manually.

	DieRotations[0] = new Vector3(-90,0,180);
	DieRotations[1] = new Vector3(180,0,90);
	DieRotations[2] = new Vector3(180,180,0);
	DieRotations[3] = new Vector3(90,0,0);
	DieRotations[4] = new Vector3(0,0,90);
	DieRotations[5] = new Vector3(0,0,0);

so I tried to this in my Update () method:

	float speed = 0.01f;
	 Quaternion localRotation = gameObject.transform.localRotation;
	 Quaternion rotationTo = new Quaternion(DieRotations[4].x,DieRotations[4].y,DieRotations[4].z,0);
localRotation = Quaternion.Lerp(localRotation,rotationTo,speed*Time.deltaTime);
		 gameObject.transform.localRotation = localRotation;

This will work for certain angles, but in some cases it doesn’t work.
for example in this case it keeps going (as seen in inspector window) to (0,0,180)…

Any idea what I am doing wrong here? or why this is happening?


It’s probably because you’re building your quaternion manually. Quaternion x,y,z is not what you probably think (unless you really understand quaternions). If you’re trying to build a Quaternion from a Vector3 you should use Quaternion.Euler

public Quaternion rotation = Quaternion.Euler(new Vector3(0, 30, 0));