Hehe. Trust me, an integer won’t eat more memory as it increases.
In the worst case, it will wrap around when it reaches its maximum value (and you’ll never reach that). On the other hand, a modulo operation is fairly expensive.
How is it expensive? It just limits the number from increasing beyound that limit. A integer is limited by the OS bit (32->1 and 64->1, more or less, it just waste whats left for it to use. (Don’t get me wrong; I really dont know.) It can be reach if the hpr is saved (like in my game) I know cus I’ve hit it lol or I’m perty sure I have.
well modulo operation IS expensive. if you take multiplication or division or addition most of them are single or at least very-few machine-instruction-cycles.
for risc architectures thats usualy one or 2 machine cycles.
a modulo operation has to be realized with many of those. i once had a case where a modulo operation dragged more 80 asm instructions into my code (on an microcontroller). so at least on microcontrollers it’s a noticeable performance hit. on a standard desktop it’s neglectable as long as you dont use it excessivly.
those things aside. rotations usualy are float values anyway so what’s that integer discussion all about? there are very few cases where you would want to keep your rotation within a fixed range.
btw. IF you go with 64bit integers there is no need to worry. even if your character spins with >100000rotations per second you need hundrets of years to get an overrun. 32bit should withstand at least a few days with speeds <60 rotations per second.