Rotation back to its original position

hi!!

I am trying to do an effect when the mouse moves to an object, it will move in its z axis which is already working, here’s my script for it :

function OnMouseOver()

{

transform.Rotate( 0, 0, Time.deltaTime*150);

}

function OnMouseExit()

{

transform.Rotate( 0,0,0);

What I am trying to achieve is that when the mouse leaves the object, it will move back to its original position.

Please help me!!

Thanks!!!

You will need to store the original rotation in a Quaterion member.
You can set a quaternion member _StartRotation in the Start function, and each time you need to restore the original rotation, you will just need to do transform.rotation = _StartRotation;

Cheers