So a few days ago I asked about making orbit controls zoom in and out I managed to get the camera to do this but now I face a new problem.
The new problem is after the camera and controls finish tweening the camera (or it might be the model) jumps a little does anyone know why and what is causing this?
What I have tried:
I thought it might be object.lookAt so I tried this:
var startRotation = new THREE.Euler().copy( camera.rotation );
camera.lookAt( controls.object.position );
var endRotation = new THREE.Euler().copy( camera.rotation );
camera.rotation.copy( startRotation );
new TWEEN.Tween(camera.rotation).to({x: endRotation.x, y: endRotation.y, z: endRotation.z}, 600).start();
Didn’t work so then I thought well maybe it’s object.position or object.zoom so I tried this:
var tweenPositionToReset = new TWEEN.Tween( controls.object.position )
.to( { x: controls.position0.x, y: controls.position0.y, z: controls.position0.z }, 1000 )
.easing(TWEEN.Easing.Quadratic.InOut)
.onComplete(function() {
})
.start();
var tweenPositionToReset3 = new TWEEN.Tween( controls.object.zoom )
.to( { x: controls.zoom0.x, y: controls.zoom0.y, z: controls.zoom0.z }, 1000 )
.easing(TWEEN.Easing.Quadratic.InOut)
.start();
That didn’t work
Has anyone got any idea’s to how to solve this?
bandicam 2020-06-27 09-44-57-322
Here is a codepen there is a white button right in the top Left to reset the scene (hard to see):
Thanks in advance!
Edit: the above video of the problem doesn’t show up so if that’s the same for anyone else here is the problem in youtube format: https://www.youtube.com/watch?v=ns_JHwpf7uk