How to change camera direction

Hi. I’m new to ThreeJS so maybe I’m missing something obvious. My scene has a WebGLRenderer rendered cityscape. On user interaction I would like to focus camera at different points of the scene. I can easily move the camera manipulating camera.position but even moved it always pointing to the same point (my guess is the center point of the scene). I was also trying to use some random coordinates with camera.lookAt but it is not having any effect. Any hint is highly appreciated.

1 Like

Are you using any controls in your scene? Controls take over camera calculations and override whatever changes you apply manually to the direction of the camera.


No. I do not use the controls.

Then, better to provide a minimal editable working example, that demonstrates the issue. Jsfiddle, Codepen, Codesandbox etc.


Here is a astronomical demo that I created that uses different camera locations (selectable in the lower left). In the first two options, the camera is mounted to a “selfie stick” which rotates around the Earth center, the camera rotation is fixed inward towards Earth, you are changing the position of the camera by rotating the stick. In the third and fourth options, the camera is mounted on a fixed platform on the surface of the Earth. In the third option, the platform is positioned away from the Sun. In the fourths option, the platform rotates with the Earth.

I do not use OrbitControls. As noted above, I can control both the location and rotation of the camera by using different mounting points and can rotate either the camera or the mounting points. But if it is possible to do the same thing using OrbitControls, that would probably be a better solution since OrbitControls is such a handy tool.

I just wanted to show you what can be done to confirm if that is the kind of flexibility you are looking for.

I do not use “LookAt” a lot because I discovered that it removes any z-rotation.

After all I have found that this was caused by controls. Thought I removed them from my code but not entirely. Please excuse my stupidity. Thank you all for the replies.