I'm currently working on making an object follow the camera to create a rifle viewfinder effect. I am using OrbitControl, but I've run into an issue with the camera rotation range. The camera.rotation.y property only goes from -PI/2 to PI/2, even though I can rotate the camera a full 360 degrees. I'm having trouble understanding this limitation and would appreciate some help!
Here's a snippet of my code:
pivot = new THREE.Object3D();
pivot.add(viewfinder);//adding viewfinder as a child of pivot
scene.add( pivot );
Later on in the code:
pivot.rotation.y = camera.rotation.y;
Although this allows me to rotate my viewfinder, it is shifted by Pi/2 for some reason. To fix this, I adjusted the rotation as follows:
pivot.rotation.y = (camera.rotation.y - (Math.PI/2));
With this adjustment, I can now rotate the viewfinder with the camera within a range of 180 degrees. How can I achieve a full 360-degree rotation? Any assistance would be greatly appreciated. Thank You.