# Problem in Euler angles

Good afternoon. I have the following problem. For object rotation I use Quaternion.Euler with value of the appropriate angles. As I understood in a number of experiments, in Unity there is a certain problem for angles of the close to 90 degrees in case of rotation on a y axis. For example, following code:

`````` void start() {
this.transform.rotation = Quaternion.Euler(88, 0, 0);
Debug.log("myangles=" + this.transform.eulerangles.x);
}
``````

In my debug, I see: “myangles=90”. After several experiments, it is possible to tell with confidence that the such happens to value of an angle from 87 degrees. That is to 87 degrees value in logs matches what I set as Quaternion.Euler, but after 87 for some reason there is a rounding to 90 degrees. Prompt please, whether it is possible to make so that in Unity the correct values for the angles close to 90 degrees were put. (I sometimes need to rotate the camera to value 90, and then smoothly to transfer it to value 0 without involvement of the user)

The behavior is strange to me. Even though the Inspector reports 90, an object is clearly being rotated to 88 degrees. Regardless of this issue, it is a bad idea to read from eulerAngles if you can avoid it. There are situations where Unity changes the euler representation of the current physical rotation. So a work around would be to keep your own Vector3. Example:

``````Vector3 myEuler;

void Start() {
myEuler = new Vector3(88,0,0);
transform.eulerAngles = myEuler;
Debug.Log("my X rotation: " + myEuler.x);
}
``````

It’s a known issue with conversion from Quaternion to euler angles. Just use the Quaternion rotation functions and you’ll be fine.

`transform.rotation = Quaternion.Euler(88, 0, 0);`

will give you a rotation of 88.

`transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, 0, 0), Time.time * speed);`

will rotate you back to zero