Question by
JesseFox · Aug 30, 2016 at 08:15 AM ·
rotationeuleranglesdegrees
How to get rotation degrees?
Just wanting to know if it is able to get the rotation degrees in a negative value opposite to the positive value ( 0, 180) instead of it reading 0, 360? if any one could help me thanks :)
screen-shot-2016-08-30-at-60314-pm.png
(26.3 kB)
Comment
Best Answer
Answer by etaxi341 · Aug 30, 2016 at 12:08 PM
Just read the value from 0 to 360 and subtract 180
Or you could also check if the value is greater than 180 and then subtract 360 if this is the case (with this method 0 would keep the same as at 0 to 360. The first method would shift everything by 180 degrees)
float rot = -396f;
while (rot < -180f)
rot += 360f;
while (rot > 180f)
rot -= 360f;
print(rot); //Returns rotation from -180 to 180
Calculates exactly what rotation value I'm needing. thanks heaps mate