2d rotation while making green axis always point up

I am working on a 2D game and rotating a object on its Z axis. How do i keep the green axis always pointing up while rotating at Rotate(0,0,90);. Thanks…!

Rotating an object around an axis (z-axis in your case) changes the vectors of both other axes naturally, so what you want is technically impossible.

Hence, if you want the green axis (y-axis) to keep looking in the same direction, you have to rotate the object around it’s y-axis.

If you explain your problem in more detail I can possibly better help you out.

I think he wanted ‘up’ to still be ‘up’, while rotating the object. Imagine a ball rolling down a hill. The orientation of the ball itself changes, but up is still up.

The answer is that ‘global’ up is still up, but local up will change. Personally, I’d have an empty game object as the root object, and then the object you want to rotate as a child of that empty object. Then you rotate the child, and ‘up’ is still ‘up’ for the main object.