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,我希望能够使用鼠标在场景周围平移摄影机。到目前为止,我已经使用轨迹球控件通过单击和拖动来创建这种效果 function init(){ camera = new THREE.PerspectiveCamera(45,window.innerWidth / window.innerHeight, 1, 1000); camera.position.z = 500; controls = new THREE.TrackballControls(camera); controls.a

我希望能够使用鼠标在场景周围平移摄影机。到目前为止,我已经使用轨迹球控件通过单击和拖动来创建这种效果

function init(){
  camera = new THREE.PerspectiveCamera(45,window.innerWidth / window.innerHeight, 1, 1000);
  camera.position.z = 500;

  controls = new THREE.TrackballControls(camera);
  controls.addEventListener('change', render);
}

function animate(){
  requestAnimationFrame(animate);
  controls.update();
}
有没有一种方法可以做到这一点,而不必点击?类似于

到目前为止,我已经取得了进展


谢谢:)

没关系,我已经解决了:)

如果有人想做和我做的一样的事