收藏
回答

AR v2功能使用VKCamera时,如何获取当前相机的位置和姿态?

const frame = session.getVKFrame(canvas.width, canvas.height)

const ar_camera = frame.camera

camera.matrixAutoUpdate = false

camera.matrixWorldInverse.fromArray(ar_camera.viewMatrix)

camera.matrixWorld.getInverse(camera.matrixWorldInverse)

根据视图矩阵viewMatrix似乎可以获取相机的当前坐标,但是在世界坐标系中的姿态如何获取?

回答关注问题邀请回答
收藏

1 个回答

  • frye张
    frye张
    01-22

    let position = new this.THREE.Vector3();

    let quaternion = new this.THREE.Quaternion();

    let scale = new this.THREE.Vector3();

    camera.matrixWorld.decompose(position, quaternion, scale);


    01-22
    有用
    回复
登录 后发表内容