Jump to content

VR fixed sight


Recommended Posts

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

Link to comment
Share on other sites

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

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.

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.


  • Recently Browsing   0 members

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