【问题标题】:Trying to convert Go Pro GYRO Data to rotation in Three.js尝试在 Three.js 中将 Go Pro GYRO 数据转换为旋转
【发布时间】:2023-04-08 13:04:01
【问题描述】:

我正在尝试将 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) 

但我无法让旋转与相机的旋转相匹配,我认为这与左/右手配置有关?

谁能帮忙?

【问题讨论】:

    标签: javascript three.js rotation euler-angles gopro


    【解决方案1】:

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

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

    其次,查看 Three.js 轴,取自editor

    如您所见,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); 
    

    【讨论】:

    猜你喜欢
    • 2013-04-13
    • 1970-01-01
    • 2016-10-06
    • 1970-01-01
    • 1970-01-01
    • 2021-12-11
    • 1970-01-01
    • 2010-12-06
    • 2016-10-10
    相关资源
    最近更新 更多