英文:
Is there a method like subVectors() but for Quaternions?
问题
我曾经使用getWorldRotation()与我的Vector3,但由于getWorldRotation()似乎已经不存在,我现在尝试使用getWorldQuaternion()。但现在我遇到另一个问题,因为之前我使用了subVectors(),如果我要切换到Quaternions,就不能这样做了。是否有类似于subVectors()的内置方法适用于Quaternions?
查看了Three.js文档一会儿,但找不到它。
英文:
I used to use getWorldRotation() with my Vector3 but since getWorldRotation() seems to be gone I am trying to use getWorldQuaternion(). But now I have another problem since before I used subVectors() and now can't do that if I'm having to switch to Quaternions. Is there any built in method like subVectors() for Quaternions?
Looked at Threejs docs for a bit but could't find it.
答案1
得分: 0
如果要结合两个四元数旋转效果,您应该将它们相乘,而不是相加。同样,如果要减去一个四元数,应该将其与其逆四元数相乘。
quatResult = new THREE.Quaternion().multiplyQuaternions(quaternion1, quaternion2.invert())
英文:
If you want to combine the effect of two quaternion rotations, you multiply them, not add them. Similarly, If you want to subtract multiply it with its inverse.
Ref
quatResult = new THREE.Quaternion().multiplyQuaternions(quaternion1, quaternion2.invert())
答案2
得分: 0
getWorldRotation() 得到了欧拉角,对吧?
这将为您获取欧拉角(我希望):
let quaternion, rotation;
object3d.getWorldQuaternion(quaternion);
rotation = new THREE.Euler().setFromQuaternion( quaternion, eulerOrder );
英文:
getWorldRotation() got you the Euler angles, didn't it?
This will get you the Euler angles (I hope):
let quaternion, rotation;
object3d.getWorldQuaternion(quaternion);
rotation = new THREE.Euler().setFromQuaternion( quaternion, eulerOrder );
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论