I am still having trouble understanding the effects of changing a camera’s lookat point. If I merely move the camera without changing the lookat point, I understand the behavior, but if I then change the lookat point to rotate the camera to look back at the original point, I am seeing an unexpected rotation about the y-axis.
Below are three drawings. First is the initial drawing with camera at (297, -2323, 2031) and the camera’s lookat point set to (272, -644, 606), shown by the blue sphere.
Then I move the camera to the right by 800 units to (1097, -2323, 2031), resulting in the structure moving left and almost off screen but the lookat point remaining fixed because the camera angle has not changed, just the camera x position.
That makes sense to me. Now, if I reset the lookat point back to the original value, then the structure moves back into view, as desired and expected, but also produces a rotation about what appears to be (pretty close to) the y-axis, which is not what I expected. Can someone convince me that this non-intuitive (to me, anyway) result is correct, or else, tell me what I’m doing wrong?
There is a large amount of code to generate these drawings, so it’s not practical to post it here, but the relevant parts, once the drawing is done, is simple:
camera.position.x += 800; // re-render
const preferred_lookat = // ...some method to retrieve it camera.lookAt (preferred_lookat) // reposition the blue sphere to preferred_lookat // re-render
Thanks so much.