Here is a quick tutorial on how to setup a WebVR compatible environement and use WebVR on your ForgeJS projects.

Get a WebVR browser

The first thing you need to have for using WebVR is a compatible browser! Not all browsers are compatible at this time, in fact almost only the beta versions of browsers are WebVR compatible. And some browsers are only compatible with their headset like Samsung browser for gear VR. Many ressources are available online to know which browser is compatible like WebVR Rocks.

WebVR polyfill

If you do not have a WebVR compatible browser, you can still add the WebVR polyfill script to simulate the WebVR API for non compabile browsers. The polyfill script is available on GitHub.

HTML page requirements

Your html page head section must have the following viewport meta tag:

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, shrink-to-fit=no, user-scalable=no" />

Add a WebVR button

On the Forge project side, you will have to add a UI component to allow the user to switch to WebVR mode. The ForgeJS team provides the WebVR Button plugin available in our plugins repository to do this. Note that this button will not appear on a non compatible browser!

24th Apr 2017