In my current setup, I have a particular object in view using a PerspectiveCamera
. By utilizing OrbitControls
, I can navigate around the object, rotate it, pan it, and more.
My goal is to reposition the object to a specific location at a specific angle and then retrieve the camera's position and rotation. I plan to update the camera with these values later on. However, there seems to be an issue with three.js not applying some of these values correctly. Here is how I am attempting to obtain the camera's position, rotation, and the lookAt vector:
console.log("Position", camera.position)
console.log("Rotation", camera.rotation)
console.log("World Direction", camera.getWorldDirection())
Once I have these vectors, I document them and apply them like so:
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000);
camera.rotation.set(-3.14, -0.44, -3.14);
camera.position.set(-1067.29, 34.23, 205.82);
camera.lookAt(0.43, -7.10, 0.90)
However, I encounter an issue where the rotation and position values change unexpectedly if I have used the pan
function with OrbitControls.