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
Javascript 在three.js中鼠标悬停时停止旋转_Javascript_Three.js - Fatal编程技术网

Javascript 在three.js中鼠标悬停时停止旋转

Javascript 在three.js中鼠标悬停时停止旋转,javascript,three.js,Javascript,Three.js,我已经编写了一个函数,我想通过它停止鼠标悬停时three.js对象的旋转 function onDocumentMouseUp( event ) { event.preventDefault(); mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1; mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1; raycaster.setFromCamera( mouse, c

我已经编写了一个函数,我想通过它停止鼠标悬停时three.js对象的旋转

function onDocumentMouseUp( event ) {
event.preventDefault();
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
 raycaster.setFromCamera( mouse, camera );
var intersects = raycaster.intersectObjects( scene.group );
if ( intersects.length > 0 ) {
  if ( INTERSECTED != intersects[ 0 ].object ) {

    if (controls.AutoRotate) {
       controls.autoRotate = false;
    }     }
  }


}

不知道为什么,但函数不工作,也没有在控制台中给出任何错误。有人能告诉我这里的问题是什么,或者建议这个问题的可能解决方案吗。它不起作用可能是因为我在three.js中嵌入DOM元素并使用css渲染器。

控件。AutoRotate
不存在,所以它永远不会等于true。

控件。AutoRotate
不存在,所以它永远不会等于true。

在three.js中,旋转是通过three.js中的orbit control.js进行的旋转是通过轨道控制实现的。jsI没有在这里发布全部代码。controls.AutoRotate在init()函数中设置为True。
controls.AutoRotate
controls.AutoRotate
不同,我没有在这里发布全部代码。controls.AutoRotate在init()函数中设置为True。
controls.AutoRotate
controls.AutoRotate