Afshin2 Posted November 4, 2015 Share Posted November 4, 2015 Hi everyoneI 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.. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 5, 2015 Share Posted November 5, 2015 Hello, you may want to update this code:https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/VR/babylon.webVRCamera.ts#L54 Quote Link to comment Share on other sites More sharing options...
Afshin2 Posted November 5, 2015 Author Share Posted November 5, 2015 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 Quote Link to comment Share on other sites More sharing options...
Afshin2 Posted November 5, 2015 Author Share Posted November 5, 2015 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 5, 2015 Share Posted November 5, 2015 There should be no difference between the two camera regarding distortion. can you create a playground with the code you are using? Quote Link to comment Share on other sites More sharing options...
Korreca Posted March 1, 2016 Share Posted March 1, 2016 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! GameMonetize and dbawel 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 1, 2016 Share Posted March 1, 2016 Do you want to submit a PR to fix it? Quote Link to comment Share on other sites More sharing options...
Korreca Posted March 1, 2016 Share Posted March 1, 2016 Sure! I have already sent As commented in the PR, I can't test it with DK1, but with DK2 and runtime 0.6.1.0 and above, this changes fix the problem. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 2, 2016 Share Posted March 2, 2016 It works well THANKS! Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted March 17, 2016 Share Posted March 17, 2016 On 2/29/2016 at 5:53 PM, Korreca said: 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! Pretty awesome, Korreca! I would love to see a demo of this. Is it and/or the code available that shows what you're doing with the camera? Thanks! Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted March 24, 2016 Share Posted March 24, 2016 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! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 24, 2016 Share Posted March 24, 2016 Can you try with Chrome instead? This may be a bug in Firefox Quote Link to comment Share on other sites More sharing options...
steven_EXC Posted March 31, 2016 Share Posted March 31, 2016 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? Quote Link to comment Share on other sites More sharing options...
steven_EXC Posted March 31, 2016 Share Posted March 31, 2016 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? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 1, 2016 Share Posted April 1, 2016 Hello I also have a DK2 and the only thing you have to do is to duplicate your screen on windows (the DK2 is seen as a second monitor) then enable fullscreen Quote Link to comment Share on other sites More sharing options...
steven_EXC Posted April 5, 2016 Share Posted April 5, 2016 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? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 6, 2016 Share Posted April 6, 2016 I don't know From webpages the only control we have is through webvr. Did you try to engage fullscreen mode on your page? Quote Link to comment Share on other sites More sharing options...
Gwir Posted June 16, 2016 Share Posted June 16, 2016 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. Quote Link to comment Share on other sites More sharing options...
dbawel Posted June 16, 2016 Share Posted June 16, 2016 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.