Help with interpolation

Hey - I have an object that I rotate around its X and Y axis by using

transform.Rotate(x,y,0.0F);

which works fine. By doing this rotation the Transform also gets some z rotation which is also fine. What I want to though is then have the object’s x and z axis return back to 0 while maintaining it’s Y axis. So basically the tilt and roll come back to a neutral state while the yaw remains. If I run something like:

transform.rotation=Quaternion.Lerp(transform.rotation,Quaternion.identity,Time.deltaTime);

it (obviously) returns all three axis back to 0 - what’s the best way for me set a target to interpolate to that’ll keep the yaw?

Any help appreciated.

weird, I was just looking at another post that did exactly what you are asking, but it was for an airplane…

http://forum.unity3d.com/threads/68786-Spacecraft-script-WIP-seeking-advice

Thanks for the info. I ended up applying the rotation, storing the Y rotation, interpolating back to a neutral position and then re-applying the Y rotation. I’m not sure if it’s the cleanest but it’s only a few lines of code and seems to give a nice smooth result