尝试将 Go Pro GYRO 数据转换为 Three.js 中的旋转

Trying to convert Go Pro GYRO Data to rotation in Three.js

我正在尝试将 Go Pro 陀螺仪数据转换为 Three.js 坐标,以便我可以将素材投影到球体内部,旋转球体并进行 3D 稳定。

相机是这样定位的,坐标顺序是Z,X,Y

我正在尝试应用此向量来旋转球体,类似这样

    this._nextVec3.set(this._next[0],this._next[1],this._next[2])
    this.el.object3D.rotation.setFromVector3(this._nextVec3) 

但是我无法获得与相机旋转相匹配的旋转,我认为这与 left/right 手部配置有关?

有人能帮忙吗?

首先,请确保您指定了正确的 rotation.order attribute。既然你说是ZXY,那应该是简单的

this.el.object3D.rotation.order = "ZXY";

其次,检查 Three.js 轴,取自 editor:

如您所见,WebGL 轴与 GoPro 不同。我想你必须翻转 X-axis,并交换 Z 和 Y。所以可能是这样的:

let xRot = this._next[0];
let yRot = this._next[1];
let zRot = this._next[2];
this.el.object3D.rotation.set(-xRot, zRot, yRot);