I'm currently working on a webVR project where I previously used the resetPose
function to reset the origin of the scene. However, it seems that this function is now deprecated. The purpose of using it was to bring the camera back to focusing on the center of the scene.
I know that replicating this functionality shouldn't be too difficult - either rotating the scene or the camera towards the new origin should do the trick. My challenge lies in my limited experience with webVR and specifically THREE.js.
I attempted to use the lookAt
method to orient the camera towards the center of the scene, but encountered issues due to the constraints imposed by webVR on controlling the camera position directly.
Here's an example of how the camera and scene are initialized:
// Setting up a three.js camera.
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 10000);
camera.name = "Perspective Camera";
var group = new THREE.Group();
group.name = "Camera Group";
group.rotateY(Math.PI);
group.add(camera);
group.position.set(0, configuration.sphereRadius, 0);
group.permanent = true;
scene.add(group);
// Integrating VR headset positional data for camera movement.
controls = new THREE.VRControls(camera);