Euler angles appear to not be calculated correctly

So I've been trying to implement some different methods that TrueSync hasn't made mirror methods for yet(RotateTowards for example). And I noticed something that seems incorrect to me.

When I use this line of code Debug.Log(rot.eulerAngles.y + " : " + rot.ToQuaternion().eulerAngles.y);

For some angles I get something close like "45.0002 - 45"

But for other angles I get something like far apart like "-43.06105 : 223.0606"

I'm going to guess this is not intended behavior. (I have tested my code using ToQuaternion and it moves as expected but of course before I can use TrueSync I need to reimplement this not using floats)


  • Hi @Zergleb, thanks for the report, for some angles we get a "inverted" result, if you take a look 180 + 43 will be equals to 223.
  • Ok but it only goes from -90 to 90 that only covers 180 degrees. so how would I calculate the value I need in these situations.

    once again this is the debug line
    Debug.Log(rot.eulerAngles.y + " : " + rot.ToQuaternion().eulerAngles.y);

    45.002 : 45
    45.002 : 135 (This is 180 - 45 true, but how do I tell the difference between this 45 and the above 45)
    -45.002 : 225
    -45.002 : 315 (Similar situation how do I know whether to subtract 45 from 360 or add 45 to 180)

    Being able to create the values I would get from unity would allow me to use the techniques I use in other unity games. Thank you very much for taking the time to look at this issue.

  • Hi @Zergleb, thanks again for your report, we will take into account some situations to follow the same pattern as Unity.