- Home /
Weird results when rotating a GameObject
So I want to have a light source in the game rotate randomly, however in messing around with the light to see what settings I wanted, I found something odd. When I would rotate the object using its handles, only the X value would change. If I rotate a different axis, the Y and Z axes will begin changing in multiples of 180, while only the X axis actually changes smoothly. If I try to change values from the inspector, changing the X value will rotate it along the X axis, while changing the Y and Z only spin it around the Y axis.
I've tried doing it in both local and global modes. Any ideas?
$$anonymous$$y guess is that you have gimble lock issues and/or you are running into the changing representation of eulerAngles. $$anonymous$$ore on both can be found in this answer:
http://answers.unity3d.com/questions/799824/oafatwhy-does-transformrotationx-45-not-work.html
In order to give you a workable answer for a random rotation (or series of them as implied here), we need to understand the nature of the rotation you are trying to create.