Z value of rotation problems.

So i am trying to make the gun rotate to mouse when click. But one problem is when im not in play mode, i rotate the gun in Z values so its become negative number which i would like to use, but when im rotate it with script (transform.Rotate) in negative Z ,enter Game mode with the same way, it turns to positive value, anyway to fix this?

Negative rotations are mathematically equal to positive ones. -90 degrees == 270 degrees, for example. Unity will automatically use the positive variant (mod 360), but this shouldn’t have any effect on your code if you’re comparing them correctly.

2 Likes

OMG thanks alot i figured it out