Sign in to follow this  
angeltrickz

VR camera does not work

Recommended Posts

var camera = new BABYLON.VRDeviceOrientationFreeCamera ("Camera", new BABYLON.Vector3 (-6.7, 1.2, -1.3), scene, 0);
    
    camera.attachControl(canvas, false);
    console.log(camera.inputs.attached)
    camera.inputs.attached.deviceOrientation.detachControl(canvas);
    var onOrientationEvent = function(evt) {
        this._alpha = (+evt.alpha | 0) + 45;
        this._beta = (+evt.beta | 0) + 45;
        this._gamma = +evt.gamma | 0;
        this._dirty = true;
    }
    
    camera.inputs.attached.deviceOrientation._deviceOrientationHandler = onOrientationEvent.bind(camera.inputs.attached.VRDeviceOrientation);
    camera.inputs.attached.deviceOrientation.attachControl(canvas);
   
     scene.activeCamera = camera;

A few years ago I was working with a webvr project and this code worked for me with a cell phone but now it does not work and I searched for more vr methods in babylon, but none works as before the movement of the phone ..

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.