Why does the rotation attribute for an actor continue to increase indefinitely beyond 360?
cslave2
Member Posts: 0
Why does the rotation attribute for an actor continue to increase indefinitely (infinity?) beyond 360 instead of going back to zero after a full rotation? I want to make a simple rule that changes the color of an actor depending on its rotation: between 0 and 90, it's one color; between 90 and 180, it's another, etc. I can do this for the first 360 degrees, but because the attribute keeps increasing, the rules stop applying after 360. To check this, I made an actor that displayed the rotation of my first actor and it went up into the 1000s.
Best Answer
-
RThurman Posts: 2,880Angles are still valid no matter how high the number gets. For example 1080, 720, 360, and 0 are all the same angle. This can come in handy in certain situations.
It is possible to change the angle back to the 'normal range' by using the mod(x,y) function. Use something like this:
Constrain Attribute: self.myRotation To: mod(self.Rotation,360)
The modulo function divides self.Rotation by 360 and only spits back the remainder left over. It will give you the 0 to 360 range you want.
Answers