i have a script that turns a light on and off depending on the rotation of an object, but its not working correctly, can you see if you guys can help me fix it?
What’s rotate? Transform.rotation stays within a magnitude of one, from zero. Hopefully rotate isn’t a Transform, but if it is, that won’t work. Transform.eulerAngles can be greater than 180, but it will get recalculated at some point.
I had some trouble testing this so I don’t have much help, but a question I have is, what object are you rotating? And are you certain that your are rotating it on the “x” axis. Because according to your script it looks like your asking for its “x” axis. And if your still having trouble, take a cube or something in a new scene, set up your “sun” and rotate your cube on its “x” axis. Its good to isolate your scripts if your having problems. So just making it an object and your sun. Rotate your object and see if its still not working. I made a very easy to use rotate script for you. It rotates whatever you put it on on its “x” axis.