Jump to content

Oculus camera rotation


Afshin2
 Share

Recommended Posts

Hi everyone

I am trying to get Oculus Rift DK2 working with my WebGL Javascript code.

I am attaching WebVRFreeCamera to my canvas in the scene.

I can see that some head tracking happening but unfortunately in the wrong directions.

For example if I rotate my head about X axis canvas rotates in Z axis and vice versa.

Did anyone has experimented this before? Any solution?

Thanks..

Link to comment
Share on other sites

Thanks for reply.

 

I am now directly accessing PositionSensorVRDevice.getState().orientation which gives me quaternion. From that I extract euler angles and in my render function apply it to my WebVRFReeCamera(vrCamera) as below:

        var quat = vrSensor.getState().orientation;        var vrEuler = new BABYLON.Vector3(0, 0, 0);        eulerFromQuaternion(vrEuler, quat, 'YXZ');        vrCamera.rotation = new BABYLON.Vector3(vrEuler.x, vrEuler.y, vrEuler.z);

However problem still exist.

 

Interestingly if I replace WebVRFReeCamera with a simple FreeCamera, everything looks good and the camera is properly follows Oculus headset rotation, but of course there are no two left and right eye cameras and no distortion fix with FreeCamera

Link to comment
Share on other sites

I just tried with DeviceOrientationCamera which works ok as well i.e. properly tracks the headset if i set camera rotation as above in beforeRendering.

The problem now is that it looks like distortion is not fixed with this camera.

In general what is the difference between WebVRFreeCamera and DeviceOrientationCamera?

Thanks again for your help.

Link to comment
Share on other sites

  • 3 months later...

Hi there!

A little late but... I fix this just last week for our demo at JustMad7.

Change this:

this.rotation.x = -this._cacheRotation.z;
this.rotation.y = -this._cacheRotation.y;
this.rotation.z = this._cacheRotation.x;

For this: 

this.rotation.x = -this._cacheRotation.x;
this.rotation.y = -this._cacheRotation.y;
this.rotation.z = this._cacheRotation.z;

You can see a little video at 

We are using Oculus DK2 with runtime 0.6.1.0 on Firefox Nightly, one fullscreen window on oculus with WebVRFreeCamera an another one with an UniversalCamera, sending rotation from VR to Universal and position from Universal to VR via storage events.

Later this week we are going to make it public this demo, I will come to put a link so you can try it and give us feedback!

Link to comment
Share on other sites

  • 2 weeks later...
On 3/24/2016 at 0:39 PM, FlashyGoblin said:

I'm having an issue getting the Babylon scene to display in my DK2. I think I'm missing a key element with entering WebVR mode to allow the scene to get to the Oculus. 

I'm using:

  • Oculus DK2
  • FireFox Nightly
  • WebVRFreeCamera

Thanks all!

I'm having a very similar problem.  What is the intended way to enter WebVR mode?

Link to comment
Share on other sites

To elaborate on my problem:

I've got an Oculus Rift headset that interacts with Firefox Nightly.  I can see that It is properly picking up orientation but I don't think it's picking up positional tracking.  I'm using a WebVRFreeCamera for my camera.  The scene renders on my monitor just fine with the intended two lenses indicating the camera has been set up properly and the camera rotates around as I rotate my Rift.  How do I get what I see on my monitor onto the Rift?

With ThreeJS, I have seen this used: https://github.com/borismus/webvr-boilerplate. This places a nice icon on the bottom corner of the screen for handling transitioning into VR mode.  Is there a BabylonJS equivalent to something like this? Or maybe some function call I'm missing that throws the scene onto the Rift?

Link to comment
Share on other sites

  • 2 months later...
On 5/4/2016 at 8:29 PM, steven_EXC said:

The Oculus Runtime v0.6.0.1 allows this monitor functionality with the DK2 but newer runtimes don't seem to allow this.  It looks like Oculus is currently at runtime v0.8.  Is there a way to achieve this using a more recent runtime version?

Hi, i had the same problem.

I solved rolling back to a previous version of firefox nightly. By doing this i get video output on the DK2 and tracking too.

The Oculus works fine when playing online demos like those on MozVR, clicking the ENTER VR button.

I still cant get video signal on oculus from babylon. I'm using webVrFreeCamera, i have tracking but no output.

Link to comment
Share on other sites

I also advise testing with the Samsung browser, as it is more compatable with the Oculus application - if that is what you are targetting. Just remember to enable WebGL in the Samsung browser as it is not enabled in every version - but should is in the latest couple of versions, however this needs to be check to make certain. This will provide you and others in the community more info based upon the performance using the Samsung browser on Oculus.

DB

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