Jump to content

VR camera does not work


angeltrickz
 Share

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 ..

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...