Here is the code I am using to set up my camera and position it:
const box = new THREE.Box3().setFromObject(model);
const size = box.getSize(new THREE.Vector3()).length();
const center = box.getCenter(new THREE.Vector3());
camera.near = size / 100;
camera.far = size \* 100;
camera.updateProjectionMatrix();
camera.position.copy(center);
camera.position.x += size / 0.2;
camera.position.y += size / 2;
camera.position.z += size / 100;
camera.rotation.z += Math.PI/2
// camera.up.set(0, 0, 1)
// camera.rotation.set(Math.PI / -2, 0, 0)
camera.lookAt(center);
I am having trouble with camera rotation and achieving the desired position. I have tried using camera.up.set
, but it doesn't seem to be solving the issue. Can anyone provide me with the correct code to achieve the desired outcome?