I have a question since im using Atan2 that correctly results in -pi/pi
problem is the object that im using the rotation on has its source rotation at -90 so for it to work coorecly i wanna continously add 90° to the result
problem is that Atan2 results in ranges 0 180 / -0 -180 that is fine cause the game im using them on uses it exacly like that But i have no idea how to continously add 90° but staying within the ranges
so 180 doesnt result in 270 etc
How to correctly add 90° without going out on original range ?
Example Atan2 result = 180 should retrun -90 Atan2 result = -0 should return 90 Atan2 result = 90 should return 180
how am I to create a calculation to meet these requirements ?
Instead of computing $\operatorname{atan2}(y,x)$, use $\operatorname{atan2}(x,-y)$ instead.
(I'm assuming that you are using an $\operatorname{atan2}$ that takes the $y$ parameter first, adjust accordingly.)
To see why this works, look at the point $(x,y)$ in the complex plane, that is $x+ iy$. Rotating by 90° corresponds to multiplying by $i$, so we get $-y+ix$.