Implementing targetCamera.copy(sourceCamera) manually

Hello. I am working on a project that involves restoring the state of a scene from a previously saved state. This means that I need my camera to be fully reset to an old camera’s state using the current function on ThreeJS:

var sourceCamera = //some saved camera;
var targetCamera = new THREE.Camera();

However, I am not allowed to save an entire camera object in the project that I am working on but only allowed to save matrices and rotations. This means I have to manually perform this rotation of the camera from the current position to the position of the savedCamera’s position using all of it’s existing matrices (such as matrixWorld / matrixWorldInverse / modelViewMatrix etc). What would be the right steps mathematically to achieve the above ? Thanks in advance!

@Mugen87 Would you happen to know a solution for this? Thanks in advance!

I tried the following:

        const camMatrix = // camera.matrix of a saved camera
        camera.matrixAutoUpdate = false;

        camera.matrix.fromArray(camMatrix );

For some reason this causes a weird bug where when I try to use my Orthographic trackball controls to rotate around the object, the entire world rotates but the camera remains focused on my object, which is not how the mouse controls are suppose to work.