transform.Rotate not accurate?

I’m trying to rotate an object, and my model has to be very accurate. here is my code:

print("before : " + GO.transform.localRotation.eulerAngles.y);


print("adding " + rotationToAdd);

print("after : " + GO.transform.localRotation.eulerAngles.y);

And here’s an example what I’m getting printed:

before : 167.8552

adding 11.4207

after : 178.4002

When 167.8552 + 11.4207 is actually 179.2759.

What’s going on? What am I missing?

  1. Do you have 0 on X Z before (and after rotation), if not, then it all makes sense - euler angles do not add up like that.
  2. You’re rotating in Euler angles. Unity operates with Quaternions for rotation, so it could be precision problems for converting back and forth.