mbehnaam
mbehnaam

Reputation: 431

Conflict of LookAt and controls in three.js

I am preparing an application which shows a 3D model of a building and it works fine now. I was trying to control "PerspectiveCamera" using LookAt. However, I noticed LookAt does not work when I have the following line in animate function.

 controls.update(1);

Therefore, I disabled this line (see below):

            function animate(time) {
                requestAnimationFrame( animate );
                //controls.update(1);
                TWEEN.update(time);
                renderer.render( scene, camera );
            }

However, I lose my mouse control (cannot zoom in/out) when I disable that line. If I enable that line , LookAt does not work properly.

Any suggestion? Thanks.

Upvotes: 0

Views: 120

Answers (1)

Bob Woodley
Bob Woodley

Reputation: 1284

Just call camera.lookAt() in the animation loop if you're using the controls. That will get it to re-point to whatever you want to lookAt() after you've moved things around with the controls.

Upvotes: 1

Related Questions