I want to rotate an object on its Y axis after having rotated it on its Z axis.
In Blender I can do this by changing the rotation order from XYZ to ZXY, but in Threejs I don’t know how to do it. I have imported the object to scene. This is its initial state without rotation:
This is the rotation if I modify the X axis first and then the Y axis. It works:
useEffect(() => {
model.current.rotation.x = 1;
}, []);
useFrame((state, delta) => {
model.current.rotation.y += delta;
});
But if I modify the Z first and then the Y (which is what I need to do), it doesn’t work:
useEffect(() => {
model.current.rotation.z = 1;
}, []);
useFrame((state, delta) => {
model.current.rotation.y += delta;
});
Y rotation takes the global Y axis, not local. It seems different behavior than previous example.
How can I get this rotation?