I use an animation to move a camera view around my object. I clamp the animation at the final position. I then try to duplicate the camera’s information back into my default camera so I can have the cameraControls pick up where the animation ended. But the default camera does not located / orientated to where the animation left off. Both cameras are THREE.OrthographicCamera.
AnimationMixer.addEventListener('finished', function(e){
// activeCamera is what is used in render( scene, activeCamera )
// activeCamera currently hold the camera used to animate the movement
// of the camera around to the back of my scene
console.log('anime fini callback');
let p = new THREE.Vector3(0,0,0);
activeCamera.getWorldPosition(p);
let q = new THREE.Quaternion(0,0,0,0);
activeCamera.getWorldQuaternion(q);
let s = new THREE.Vector3(0,0,0);
activeCamera.getWorldScale(s);
let d = new THREE.Vector3(0,0,0);
activeCamera.getWorldDirection(d);
let z = activeCamera.zoom;
let r = activeCamera.rotation;
console.log('anicam position: ' + p.x + ', ' + p.y + ', ' + p.z);
console.log(' quaternion: ' + q.x + ', ' + q.y + ', ' + q.z + ', ' + q.w);
console.log(' rotation: ' + r.x + ', ' + r.y + ', ' + r.z);
console.log(' scale: ' + s.x + ', ' + s.y + ', ' + s.z);
console.log(' zoom: ' + z);
console.log(' direction: ' + d.x + ', ' + d.y + ', ' + d.z);
// defaultCamera is camera tied to cameraControls used for standard
// rotating, zooming, panning, etc.
console.log('switching to camera: [default]');
defaultCamera.copy(activeCamera);
activeCamera = defaultCamera;
// you would think the above code would be enough, but no
// so, I tried...
//activeCamera.position.set(p.x, p.y, p.z);
//let t = new THREE.Vector3(that.controls._target.x, that.controls._target.y, that.controls._target.z);
//that.controls.setLookAt(p.x, p.y, p.z, t.x, t.y, t.z, true);
//that.controls.setPosition(p.x, p.y, p.z, true);
//activeCamera.setRotationFromQuaternion(q);
//that.controls.updateCameraUp();
});
Any suggestions, please.