I am using threejs with OrbitControls, and i want to rotate my camera using camera.rotateY (for example), but i can’t update the controls to the new camera position .
Because when i am moving on the scene the objects goes back to their previous rotation state.
How to adapt the controls after a camera rotation or rotate the controls too ?
I think i can’t rotate my objects because there are a very lot of them
orbitcontrol will overwrite any manual control of the camera.
as it’s name imply, it’s in charge of the rotation.
But you can disable it, then do your things, changes the values (if required) and enable it again.
If it can help, here is a sample of full reset and reconfiguration:
controls.enabled = false; //disable orbitControls
controls.reset(); //reset orbitControls
const vect3 = new THREE.Vector3(); //define any vector (here we just point at 0,0,0)
controls.target = vect3; //update orbitControls target
camera.position.set(0,500,1000); //reposition camera using some values
camera.lookAt(vect3); //optional pre-rotation (in case orbit is not updated in render loop)
controls.enabled = true; //enable orbitControl again