This project is now deprecated. WebXR support for PlayCanvas is now built directly into the engine. For more information see the developer documentation: https://developer.playcanvas.com/en/user-manual/xr/
This repository is kept for legacy reasons and should not be used in new projects.
The project contains scripts to run your PlayCanvas application in VR using either a Google Cardboard-style VR headset or (when using special builds of Chrome & Firefox) Oculus Rift and HTC Vive.
For Cardboard VR any modern mobile device should work. For Oculus and Vive support you require a special build of Chromium.
input_hmd.js
loads first, which can be changed in Editor Settings "Scripts Loading Order".vrCamera
to script component.vrCamera
will start the VR mode when you click or tap the canvas.VrCamera has a few options that are exposed on the entity in the Editor.
enterVr()
on the camera script to start VR renderinginput_hmd.js contains a version of the WebVR Polyfill by Boris Smus.