After clicking the mouse, I successfully set a new target for my THREE.OrbitControls
and it works perfectly. However, once the camera pans to the new location, I lose all mouse interaction.
I suspect that I may have broken the controls when I made the camera z and target z values the same.
The faulty code can be found here:
The corrected code is available here:
panCam(500,200,4000,1000);
var xTarget=0;
var yTarget=0;
var zTarget=0;
var tweenDuration=0;
function panCam(xTarget,yTarget,zTarget,tweenDuration){
TWEEN.removeAll();
var camNewPosition= { x : xTarget, y : yTarget, z : zTarget};
var targetNewPos = {x : xTarget, y : yTarget, z : 0};
var camTween = new TWEEN.Tween(camera.position).to(camNewPosition, tweenDuration).easing(TWEEN.Easing.Quadratic.InOut).start();
var targetTween = new TWEEN.Tween(controls.target).to(targetNewPos, tweenDuration).easing(TWEEN.Easing.Quadratic.InOut).start();
}