set angle with euler

hi all !

when i try to set object angle with euler; i have crazy result … !

view this :

void Update() {
        if (Input.GetMouseButton(1))
            transform.rotation = Quaternion.Euler( 95  , 0, 0);
}

after right mouse clic, my object angle is set to :
(85,0, 180,0, 180,0)

every one have a explication for this ?

Thx.

Try cutting out the middle step.

transform.eulerAngles = new Vector3(95, 0, 0);

same result …

this is because unity is using quaternion for rotation. unity first converts the euler angles to quaternion and later, when you want to “read” the current rotation, it converts quaternion back to euler angles. Euler( 95 , 0, 0) and Euler(85,0, 180,0, 180,0) is exactly the same orientation in space, there is just not the one and only right way to express it in euler angles

ok thanks for you reply !

but now, how to do to have a good rotation with euler angle ?