Is there a way to effectively apply a transformation matrix to a PerspectiveCamera? I have the transformation matrix and I am applying it to the Perspective camera using
camera.applyMatrix(transformationMatrix);
The camera.position
is updated correctly, but the camera.quaternion
remains unchanged. Rotation only works when I disable camera.matrixAutoUpdate = false
, but this disrupts trackballcontrols. I attempted adding camera.updateMatrix()
to trackballcontrols, but it resets the rotation.
I also experimented with setting the position, quaternion, and scale of the camera manually like so:
camera.matrixAutoUpdate = false;
camera.useQuaternion = true;
var position = new THREE.Vector3();
var quaternion = new THREE.Quaternion();
var scale = new THREE.Vector3(1, 1, 1);
transformationMatrix.decompose(position, quaternion, scale);
camera.position.copy(position);
camera.quaternion.copy(quaternion);
camera.scale.copy(scale);
camera.updateMatrix();
Despite achieving correct settings, trackballcontrols still do not function properly.
Edit: My goal is to set the matrix once, rather than at each frame.