Strange Camera Behavior When Trying to Rotate

Hey All,

I’m looking for some insight regarding cameras and their behavior when trying to look at points.

I’m currently trying to determine if a box that is passed in is within a PerspectiveCamera’s view using Frustums.

    const camera = new THREE.PerspectiveCamera(halfFOV * THREE.Math.RAD2DEG, 3/2, 0.1, 2000);
    const camQuat = new Quaternion().setFromRotationMatrix(this.mat3to4(new Matrix3().fromArray(cameraRot.r)));
    camera.setRotationFromQuaternion(camQuat);
    camera.position.set(cameraPos.x, cameraPos.y, cameraPos.z );

All information about the camera and box position is passed into the function by the handler however, it should be noted that the camera is rotated to a position that is the inverse of what I am looking to get my hands on in the final product.

With this inversion in mind, my next step was to try and set it via making it look at a point equal to the position - the normalized rotation vector, however when using .lookAt() the camera rotates on the y axis about 90 degrees, resulting in a sideways view of the box.
I’ve also tried this using .negate() to similar effect.

Does anyone have insight on how to turn the camera to the proper orientation so that Frustums can be used to check that the box is visible on the camera?

I’m not sure I fully understand your issue but when using lookAt(), it’s important to keep in mind that the method will not alter the up vector of the camera. Meaning when you use lookAt() to focus a target point and now want to transform the camera over the poles, the camera won’t “flip over”. Instead the camera will be mirrored so it stays right side up. This might explain the current behavior you see in your app.