Rotation Help

I have a game where users can tap on an object, and it will rotate it by a certain amount. However, (i’m using the object:rotate() function), the rotation doesn’t stay in a 0-360 range, it goes above that. Is this normal? I need to be able to determine if the block is right-side up or upside-down, but I don’t know how to do that if the rotation keeps going up. Anyone know how to solve this? Thanks! [import]uid: 8782 topic_id: 3564 reply_id: 303564[/import]

[lua]local r = obj.rotation
r = r + someAmount
if(r >= 360) then
r = r - 360
end
obj.rotation = r[/lua]

or

[lua]obj.rotation = (obj.rotation + someAmount)%360[/lua]
[import]uid: 6645 topic_id: 3564 reply_id: 10772[/import]

Haha, you just asked for it. Now it’s on your game. [import]uid: 66985 topic_id: 3564 reply_id: 47605[/import]