# Unity3d: Rotation of game object

Quaternion objectRotation = Quaternion.identity;
Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward);
objectRotation *= rotation;

gameObject.transform.rotation *= objectRotation;


here angle = -90

But the gameobject isn't rotating as desired, when I replaced

gameObject.transform.rotation *= objectRotation;


with

 gameObject.transform.Rotate (0,0,angle);


Then the gameobject rotated -90 degree, dont understand why the Quaternion part isn't working? It rotated 90 degrees

• I can't reproduce your problem, the first snippet works fine. My object rotates from (0, 0, 0) to (0, 0, -90) – Hellium Oct 13 '17 at 7:28
• @Hellium Do the both method behave the same way? – MrRobot9 Oct 13 '17 at 9:27
• Yes, the quaternion rotation and Rotate call gave me the same result. – Hellium Oct 13 '17 at 9:41
• Supposing angle = -90 ; Quaternion method : (0, 0, 0) => (0, 0, -90) ; (10, 20, 30) => (10, 20, -60) ; Rotate method : (0, 0, 0) => (0, 0, -90) ; (10, 20, 30) => (10, 20, -60) (same result) – Hellium Oct 13 '17 at 10:30
• Maybe, you should deal with localRotation instead of rotation, especially if you have parents already rotated. – Hellium Oct 13 '17 at 10:31