Struggling to smoothly tween the camera.lookAt method in Three.js using Tween.js. The current implementation rotates the camera directly to the object's position.
Here is the code snippet that sort of works:
selectedHotspot = object;
var tween = new TWEEN.Tween(camera.lookAt(object.position), 600).start();
However, the rotation isn't as smooth as desired. How can a smoother transition be achieved?
This function handles rendering:
function update() {
lat = Math.max(-85, Math.min(85, lat));
phi = THREE.Math.degToRad(90 - lat);
theta = THREE.Math.degToRad(lon);
target.x = 512 * Math.sin(phi) * Math.cos(theta);
target.y = 512 * Math.cos(phi);
target.z = 512 * Math.sin(phi) * Math.sin(theta);
if (!selectedHotspot)
camera.lookAt(target);
renderer.render(scene, camera);
}
UPDATE
After further testing, it seems I am unable to properly tween the camera. There might be another issue lingering. Is there something missing from the render function?