Rotate camera to point

In my example I have box at 0,0,0 and camera at -30, 0, 50. How can I rotate my camera to box position? I tried camera.lookAt but after this, camera just moved at 0,0,0, not rotate.


what I have :
what I want :

Use OrbitControls and set the target to (0, 0, 0)

When i add OrbitControls it drops camera position :frowning:

const controls = new THREE.OrbitControls( camera, renderer.domElement );,0,0) is the zero vector by default so your suggestion has no effect.

Can you please try to clarify your question? I’m afraid “rotating to a position” does not make sense.

Besides, you are using three.js files from different releases. Meaning OrbitControls from R85 and three.min.js from R110. Please never do this. Such combinations are not supported.


I don’t think it drops the camera position. It would be just appearing as though it has dropped the position because it is looking at the origin.

Doing console.log(camera.position.x) confirms it.

Also, always do controls.update() after transforming the camera.

I’m just learning and testing three.js, so first of all, sorry for my possibly incorrect questions.
I wanna create moving like this
At the beginning I have box and camera in front of it and then I want to move the camera so that she continues to look at the box. In this situation have I move and rotate camera, or move and rotate everything else except the camera?

In the render loop do this:

t = Math.min(t + 0.01, 1);
camera.position.copy(startPosition).lerp(endPosition, t);
camera.lookAt(0, 0, 0);

If you are just starting out, then this should be okay.


Thank you very much for your help, but apparently I yesterday somewhere made some small mistake in the code, and because of this, everything did not work as intended. Now, when I changing camera.position everything works as expected codepen

1 Like