从四元数获取欧拉旋转? [英] Get euler rotation from Quaternion?

查看:30
本文介绍了从四元数获取欧拉旋转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 FlyControls 来移动和旋转我的飞机(我正在做一个飞行模拟游戏),而且效果很好.但是现在我遇到了一个问题,其中一种可能的解决方案是知道我平面的欧拉角.不幸的是,FlyControls 正在使用四元数.有没有办法以某种方式获得角度?当然,我可以重写 FlyControls 模块以使用欧拉角.但如果可能的话,我想避免这种情况.

I'm using FlyControls for moving and rotation my plane (I'm doing a flight sim), and it works pretty well. However now I have ran into a problem where one possible solution would be to know the euler angles of my plane. Unfortunately FlyControls is using Quaternion. Is there a possible way to get the angles somehow? Of course, I could rewrite the FlyControls module to use euler angles. But I would like to avoid that if possible.

推荐答案

var rotation = new THREE.Euler().setFromQuaternion( quaternion, eulerOrder );

three.js r.69

three.js r.69

这篇关于从四元数获取欧拉旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆