Controlling and animating a camera using orbitcontrols

I want to create an animated scene where a camera moves around an object. It should move from XYZ position to XYZ position to … .
To determine the positions of the camera (to define them later in my animation), i wanted to use orbitcontrols and use the XYZ position.


    const controls = new OrbitControls(camera, renderer.domElement);
    controls.addEventListener( "change", event => {
        console.log( camera.position, camera.rotation );

When i reuse these exact values from the console log to camera.position and camera.rotate, the results are completely different.

Can someone explain me why this is ? And which method can i use to play around with orbit controls and use those desired camera positions in my animation ?

I’ve found the solution.
It works by also setting the target property of the orbitcontrols.

1 Like