Jump to content

WebVRFreeCamera with fixed position


Xipherx
 Share

Recommended Posts

Hi All,

I'm updating from Babylon 2.4 my project that simulate a 360 static scene with a WebVRFreeCamera and a cube with images as Textures on each side.

In 2.4 I used "trackPosition: false" in WebVROptions to not consider HTCVive position but only rotation, but in Babylon 3.0 doesn't work anymore.

Can anybody help me?

Thanks in advance!

Link to comment
Share on other sites

Hi @Xipherx,

That's a wonderful question, that I guess many will have when they start working with WebVR.

Due to the nature of WebVR, the entire transformation of the headset is submitted to the scene. It is actually very important to keep the entire transformation tracking, as it prevents the motion sickness that is sadly a part of VR experiences (when implemented wrong).

Since we moved to WebVR 1.1, we are obligated to use the transformation provided by the headset, as we are using the view and projection matrix of the VR device itself. We have no control over the position anymore, and therefore trackPoisition doesn't work anymore. We do however update the camera's position using the variable devicePosition, which is a Vector3.

But worry not, as there are workarounds. You will have to implement them yourself, but it shouldn't be a big problem. The best two ways (that I can think of) use the parent system of Babylon:

1) set the camera's parent to be an invisible mesh and set its position to be the negative of camera.devicePosition

2) Set the entire world in a container, and move this container together with the camera.

A very quick demo for 1 can be found here - https://www.babylonjs-playground.com/#5MV04#38

It is not too stable and needs to be improved, but this would be the basic starting point for you.

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