function moveCameraTo(position, duration) {
var tween = new TWEEN.Tween( camera.position )
.to( position, duration )
.easing(TWEEN.Easing.Linear.None)
.onUpdate(function () {
camera.position = new THREE.Vector3().copy(position)
camera.lookAt({x:0,y:0,z:0})
})
.onComplete(function () {
camera.lookAt({x:0,y:0,z:0})
})
.start()
}
我使用这种方法将相机移动到特定位置,并且在开始时正确移动相机。然后TrackballControls不起作用,控制台出现错误。
TrackballControls.js:318 Uncaught TypeError: _this.object.position.addVectors is not a function
at THREE.TrackballControls.update (TrackballControls.js:318)
at animate ((index):456)