问题描述
我正在尝试将Go Pro陀螺仪数据转换为Three.js坐标,以便可以将素材投影到球体内部,旋转球体并进行3D稳定化。
相机的方向是这样,坐标的顺序是Z,X,Y
我正在尝试应用此向量旋转球体,诸如此类
2 occurrences of error1: item1,item2
3 occurrences of error3: item3,item4,...
...
但是我无法获得与相机的旋转相匹配的旋转,并且我认为这与左右手的配置有关吗?
有人可以帮忙吗?
解决方法
首先,请确保指定正确的rotation.order
attribute。既然您说的是ZXY
,那么它应该很简单
this.el.object3D.rotation.order = "ZXY";
第二,检查从editor提取的Three.js轴:
如您所见,WebGL轴与GoPro不同。我认为您必须翻转X轴并交换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);