Hello,
I have a question. I probably missing some basic knowledge, because I do not understand following scenario:
I have an object, whose rotation is [0,0,0].
Then I run following 2 commands:
transform.Rotate(45, 45, 0);
transform.Rotate(-40, -40, 0);
Result is rotation = [-2.268; 15.476; -27.057]
I would expect something like: [5;5;0]
Thanks
If you take a closer look at the documentation, you will read the following:
###Transform.Rotate
Description
Applies a rotation of eulerAngles.z degrees around the z axis, eulerAngles.x degrees around the x axis, and eulerAngles.y degrees around the y axis (in that order).
If relativeTo
is not specified or set to Space.Self
the rotation is applied around the transform’s local axes.
So, the applied rotations are:
- +45° local X axis
- +45° local Y axis
- -40° local X axis
- -40° local Y axis
The result can’t be (5°, 5°, 0) because the rotation are applied to the local axis in the order XYXY. However, if the rotation would have been applied in the XYYX order, you would have a final rotation of (5°, 5°, 0°)