Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Three.js 如何在移动设备上使用DeviceOrientationControl重置摄像头位置_Three.js_Webvr - Fatal编程技术网

Three.js 如何在移动设备上使用DeviceOrientationControl重置摄像头位置

Three.js 如何在移动设备上使用DeviceOrientationControl重置摄像头位置,three.js,webvr,Three.js,Webvr,我通过three.js创建webvr,我使用DeviceOrientationControl在移动设备上创建控件,并创建recenter按钮,但我不知道怎么做,我可以通过将桌面上的orbitControls.position配置为默认位置来创建此函数,但在移动设备上不起作用 重新中心桌面代码: button.onclick = () =>{ controls.object.position.set( 1.2246467992175396e-20,

我通过three.js创建webvr,我使用DeviceOrientationControl在移动设备上创建控件,并创建recenter按钮,但我不知道怎么做,我可以通过将桌面上的orbitControls.position配置为默认位置来创建此函数,但在移动设备上不起作用

重新中心桌面代码:

 button.onclick = () =>{
      controls.object.position.set(
        1.2246467992175396e-20,
        1.6,
        0.00010000000002024652
      );
    };

您是否知道
DeviceOrientationControls
不会更改其
对象
属性的
位置
属性?也许你想重置它的
旋转
?我试图重置旋转,因为它控制着.object.rotation.set(x,x,x),但它不起作用。现在我改为旋转场景,它起作用了。@JutaJumpatong你能发布你的解决方案吗?非常感谢。您是否知道
DeviceOrientationControls
不会更改其
对象
属性的
位置
属性?也许你想重置它的
旋转
?我试图重置旋转,因为它控制着.object.rotation.set(x,x,x),但它不起作用。现在我改为旋转场景,它起作用了。@JutaJumpatong你能发布你的解决方案吗?非常感谢。