Skip to content Skip to sidebar Skip to footer

Camera Position Changes In `three.orbitcontrols` In Three.js

The THREE.OrbitControls working fine when loaded with the initial camera position, but when the camera position and camera rotation is changed using a button click. the position of

Solution 1:

If you use THREE.OrbitControls and you want to change the camera target or position you should do like this:

Update position:

camera.position.set(-0.041, 1.9, -1.21);
controls.update();

Demo

Update target:

controls.target.set(30, 167, 81);
controls.update();

Demo

Reset camera

To reset the camera to the initial position you can do:

controls.reset();

Post a Comment for "Camera Position Changes In `three.orbitcontrols` In Three.js"