Hey, I'm having some trouble with what I thought would be a simple task. I have a group of objects at the origin, and I'm trying to rotate a camera around them while always facing the origin. According to the documentation, this code should work:
camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.z = 500;
camera.position.x = 0;
camera.position.y = 0;
scene.add(camera);
var spin = Tween.create().time(5000).from( {angle:0}).to({angle:2 * Math.PI})
.apply( function (v) {
camera.position.x = 500 * Math.cos(v.angle);
camera.position.z = 500 * Math.sin(v.angle);
camera.lookAt(0, 0, 0);
});
spin.chain(spin);
spin.start();
However, the objects at the origin quickly move off screen and then return intermittently. I must be missing something here. I assumed that since there is a box at 0,0,0 and the camera is looking at 0,0,0, it shouldn't be possible for the camera to be positioned where I can't see the box, right?