Reputation: 457
When I use stereoeffect using the following code, how should I get my camera to lookAt a certain Vector3?
function animate() {
var elapsedSeconds = clock.getElapsedTime();
requestAnimationFrame(animate);
update(clock.getDelta());
render(clock.getDelta());
}
function update(dt) {
resize();
camera.updateProjectionMatrix();
controls.update(dt);
}
function render(dt) {
effect.render(scene, camera);
}
I added camera.lookAt in my initialization code but I understand the render(..)
function is constantly called and overrides my lookAt.
So, how do I correctly initialize the scene so that my lookAt point is set?
Upvotes: 0
Views: 515
Reputation: 2863
I think its more likely the controls update sending the camera back to it's own target. Try setting the controls target instead.
var lookat = vertex; /// whatever Vector3 you are using already
controls.target = lookat;
controls.update();
Upvotes: 2