function adjustCameraPosition(newPosition, animationDuration) {
var tween = new TWEEN.Tween( camera.position )
.to( newPosition, animationDuration )
.easing(TWEEN.Easing.Linear.None)
.onUpdate(function () {
camera.position = new THREE.Vector3().copy(newPosition)
camera.lookAt({x:0,y:0,z:0})
})
.onComplete(function () {
camera.lookAt({x:0,y:0,z:0})
})
.start()
}
Using the above method, I am able to smoothly transition the camera to a specific position. However, after the initial movement, the TrackballControls plugin stops functioning and an error is thrown in the console.
TrackballControls.js:318 Uncaught TypeError: _this.object.position.addVectors is not a function
at THREE.TrackballControls.update (TrackballControls.js:318)
at animate ((index):456)