Rotation by x and z does the same?


I have another very basic and stupid question on my learning path. But I really don’t get it.

In this very basic example I create a shape and then I rotate it 90 degrees by Y axis.

After that, I want to rotate 45% by object’s local X axis (to make it fall halfway in the direction of its flat side normal), but either of these 2 operations produces the same wrong result:

mesh.rotation.x = Math.PI / 4


mesh.rotation.z = Math.PI / 4

both ways it somehow rotates by object’s local Z axis, which is not the one I need. What am I missing?

UPD: I was able to achieve the wanted orientation it by simply replacing the commands above with

mesh.rotateY(Math.PI / 2);
mesh.rotateX(Math.PI / 4);

But I’m still curious why setting the rotation directly wouldn’t work.

It seems like I found the answer to my original question and it happens because of the Gimbal lock. I knew about the Gimbal lock before, but it didn’t occur to me that the three rotation axes were in hierarchical relationship with each other, that’s why I thought that Gimbal lock didn’t apply. I was wrong.

1 Like