Three.js: The camera-object seems to remember its direction

Due to my question on stackoverflow wasn’t reopened yet – here’s the question and the answer on my blog:


The camera position and direction are changed by pressing the arrow-up-button:

document.addEventListener("keydown", event => {
    if (event.keyCode === 38) {
        camera.position.set( 30, 30, 10 );
        camera.lookAt( 0, 0, 0 );

But when after I pressed the arrow-up-button, I use the mouse to zoom, pan or rotate, e.g. by rolling the mouse wheel, the camera-object seems to have remembered the camera direction from before pressing the arrow-up-button.

Is there any cache I have to empty? Or do I have to update the camera-object?


It was not the camera-object, that remembered the direction,but the control-object (OrbitControl) in the property .target.

I fixed the issue with: = new THREE.Vector3( 0, 0, 0);

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.