Nesh108 Posted June 29, 2017 Share Posted June 29, 2017 Hello! I am working on a little project and I have been using the standard 'BABYLON.FreeCamera' as a smoothCamera following the player. All easy and good. Now, I would like to add VR support for people using their phones and a VR headset. I looked around and found this: camera = new BABYLON.DeviceOrientationCamera('camera', new BABYLON.Vector3(0, 0, 0), scene); camera.setCameraRigMode(BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL, {interaxialDistance: 0.0637}); This works as in splitting the screen in half (VR-style) but it doesn't follow the player anymore. How comes? Is there a way to just have the exact same behaviour of my smooth camera but just having the possibility to look around with the headset instead of using the mouse? Also, I noticed that I had to enable WebVR on my Chrome flags to get it to work. Is there a way to avoid that? Having to tell people to go and do that is just ugly and probably they won't do it, especially on mobile. Thanks! Quote Link to comment Share on other sites More sharing options...
davrous Posted June 29, 2017 Share Posted June 29, 2017 Hello, You should use directly our VR camera instead such as the WebVRFreeCamera or VRDeviceOrientationFreeCamera based on feature detection. Here's a basic sample: http://www.babylonjs-playground.com/#IHY77X#2 Regarding browsers support, on desktop, only MS Edge has WebVR enabled by default today on Windows 10 Creators Update, Firefox 55 will also soon (august) and Chrome should by the end of the year. On mobile, only Android & Chrome has it. That's why you should fallback to the Device Orientation camera most of the time. David fenomas and Nesh108 2 Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted June 30, 2017 Author Share Posted June 30, 2017 Hey @davrous, I have checked the PG and it worked on my phone. Now I am trying to add it to my project. The WebVRFreeCamera doesn't seem to work at all (probably that requires an actual headset which I don't have) but the VRDeviceOrientation looks right. The main problem is that it doesn't seem to follow my player anymore. I set the parent of the camera but it looks like it is disregarded, so I can kind of look around but the camera won't follow the player anymore. Is that normal? The code is exactly the same, I am just changing the camera. Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted June 30, 2017 Author Share Posted June 30, 2017 Actually, I realized that chrome has the 'chrome://flags' feature in the mobile version as well and WebVR wasn't enabled. Thanks for the help! EDIT: Still the same problem though. 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.