When working with Three.js, my goal is to have a camera directed towards a specific point in 3D space.
To achieve this, I attempted to use the camera.lookAt
function in the following way:
camera.lookAt(new THREE.Vector3(-100,-100,0));
Unfortunately, it seems like this call has no impact at all. No changes are reflected on the screen regardless of the values I input into the vector.
I recently discovered that by removing the THREE.TrackballControls
from my code, the camera.lookAt()
function starts working correctly. Could there be an issue with how I'm using THREE.TrackballControls? Here's how I initialize them:
controls = new THREE.TrackballControls( camera, renderer.domElement );
controls.rotateSpeed = 10.0;
controls.zoomSpeed = 1.2;
controls.panSpeed = 0.2;
controls.noZoom = false;
controls.noPan = false;
controls.staticMoving = true;
controls.dynamicDampingFactor = 1.0;
var radius = 5;
controls.minDistance = radius * 1.1;
controls.maxDistance = radius * 100;
controls.keys = [ 65, 83, 68 ]; // [ rotateKey, zoomKey, panKey ]*/
Subsequently, within my render function, I execute the following:
function render() {
controls.update();
renderer.render(scene, camera);
}
Since resources on Three.js documentation are limited, I decided to seek guidance here. Can anyone spot any mistakes in my approach?