I want to set the rotation of the x and z axes to not rotate, but only keep the rotation of the y axis. How can I set these Quaternion

我想把旋转x,z轴设为不旋转, 只保留y轴旋转, 我该怎么去设置这个四元素呢

The easiest way is to use setFromAxisAngle as shown in the code example in the documentation.

1 Like

Thanks !-yuo

this.axis.set(x, 0, y).applyQuaternion(this.#quat.setFromAxisAngle(new Vector3(0, 1, 0), camera.rotation.y));
setFromAxisAngle seems to be unable to solve my problem

I have no idea what your problem is. I responded to the title of the topic. Here is a demo with quaternion rotation around Y axis (see lines 52 and 55): https://codepen.io/boytchev/full/qBJQdLw

Thanks for your reply

Thanks for your reply! Perfectly resolved

1 Like