devAxeon Posted September 19, 2018 Share Posted September 19, 2018 Hi ! I'm looking for a sight that is not following the scene's geometry like the gaze tracker mesh. So I tried to create a plane with a texture, child of the VR camera, that is at the center and in front of this camera. Here's what I've tried: https://www.babylonjs-playground.com/#Q1VRX3#2 But it isn't always in the center, or doesn't work without a headset connected (like for google cardboard). Furthermore, It would be nice if we can have the good scene.activeCamera on the 'onEnteringVR' event Thank you so much for your help !! Quote Link to comment Share on other sites More sharing options...
Sebavan Posted September 19, 2018 Share Posted September 19, 2018 Adding @trevordev our own VR guru ? Quote Link to comment Share on other sites More sharing options...
trevordev Posted September 19, 2018 Share Posted September 19, 2018 @devAxeon Valid concerns. There is an odd quirk with the webVR camera that it's position is not actually your head, instead it is stationary and it's sub cameras are the ones that move (left/right eye cameras). See https://doc.babylonjs.com/how_to/webvr_helper#accessing-vr-device-position-and-rotation , I would update the position of your plane on every frame like done in the example there. This is definitely not ideal as you will have to have separate logic for a vr camera vs non vr camera. The way onEnteringVR looks to be designed is that it fires right before VR is entered. This also seems odd to me, I can add an onEnteredVR event if desired. With the introduction of the webXR apis/phasing out of webVR coming to browsers we are thinking of adding new webXR support (Maybe as webXR camera) to babylon that addresses many of the existing concerns raised about the webVR apis. https://github.com/BabylonJS/Babylon.js/issues/3899 . devAxeon 1 Quote Link to comment Share on other sites More sharing options...
devAxeon Posted September 20, 2018 Author Share Posted September 20, 2018 @trevordev Thanks for those explanations ! Here's what I tried next, but I'm missing something, dunno what... https://www.babylonjs-playground.com/#Q1VRX3#3 onEnteredVR event could help in some cases yep !! Btw, good "luck" for the the webXR implementation, can't wait to test it !! trevordev 1 Quote Link to comment Share on other sites More sharing options...
trevordev Posted September 20, 2018 Share Posted September 20, 2018 Try this https://www.babylonjs-playground.com/#Q1VRX3#7. It looked like your issue was that sight was still a child of the camera. I undid that and positioned it at cameraPos + cameraForward*distance and it worked. devAxeon 1 Quote Link to comment Share on other sites More sharing options...
devAxeon Posted September 21, 2018 Author Share Posted September 21, 2018 Great !! Thank you very much @trevordev !! Just one last question: do you have any idea why this doesn't work without a headset (eg: chrome)? I would like to make it work with google cardbords, but I don't know why it doesn't have the same behavior... Quote Link to comment Share on other sites More sharing options...
trevordev Posted September 21, 2018 Share Posted September 21, 2018 Give this a shot https://www.babylonjs-playground.com/#Q1VRX3#10 Also note that using babylon objects ._variables are private which means they should not be used in production code and could be changed in the next release. devAxeon 1 Quote Link to comment Share on other sites More sharing options...
devAxeon Posted September 24, 2018 Author Share Posted September 24, 2018 That works perfectly !! Thank you so much for your help @trevordev !! 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.