Camera controls change

Hello. I am wondering why this is happening. So first the link:
https://jsfiddle.net/9xzstnvq/

First I set camera position to 20,20,20 and the image looks like this:


Ok and then I right click and drag and I read from console the new vector position of camera and the image is following:

But when I save the new position the image nr 3 is different from image no2:

Do you know why it happens. What is causing this dicreepancies?

You’re not taking into account the controls.target. When you pan the camera in the second image, the camera and the controls.target both move.

So in this case i should update both camera and target. Is it the lookAt method in which i should update the target?

Well, I’m not sure exactly what you are trying to do. But you can update controls.target exactly like camera.position. They are both Vector3.

There’s also controls.saveState() that can store a view, and the controls.reset() can restore the saved view later.