Sign in to follow this  

WebVRFreeCamera with fixed position

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!

Share this post

Link to post
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 -

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

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.