Set rotation of a transform

Hi all!

I want to rotate a transform to a specific angle, not add to the existing rotation. Currently, on every frame, I am doing:

transform.Rotate(Vector3.up * rotation);

What I expect is a smooth transition over time as “rotation” changes, however the object is spinning like crazy!

Do I need to use a method to grab the current rotation and then offset by that? Or is there a method that will allow me to directly set the rotation?

Thanks!

transform.localEulerAngles = new Vector3(x,y,z);

You can also achieve the same thing as from EulerAngles by:

t.Rotate (Vector3.up, x);

where x is the degrees of rotation you want.