ThreeJS camera.lookAt() has no effect, is there something I'm doing wrong?

前端 未结 6 537
半阙折子戏
半阙折子戏 2021-02-05 02:13

In Three.js, I want a camera to be pointed at a point in 3D space.

For this purpose, I tried using the camera.lookAt function like so:

camer         


        
6条回答
  •  感动是毒
    2021-02-05 02:48

    I ran into the same problem and was able to make it work by using OrbitControls.target. Below is what I did after declaring a controller.

        controller = new THREE.OrbitControls(camera, renderer.domElement);
        controller.addEventListener('change', renderer.domElement);
        controller.target = new THREE.Vector3(0, 1, 0);
    

提交回复
热议问题