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 Oculus and Vive support you this requires a special builds Chrome and Firefox
- Add
input_hmd.jsinto your Script Priorities to load it before the application starts. - On the Entity you wish to be your camera add
vr_camera.js. - By default
vrCamerawill start the VR mode when you click or tap the canvas.
## Options
VrCamera has a few options that are exposed on the entity in the Editor.
- enableOnClick - If disabled you must manually call
enterVr()on the camera script to start VR rendering - alwaysAcceptInput - If enabled HMD position tracking will be applied to the camera even if the camera is no "in VR".
- useFullscreen - If disabled the camera will not request to go fullscreen when VR mode is enabled
- Currently WebVR is a moving target, so APIs are changing often. This library does not implement the new 1.0 spec, though it be upgradable with no breaking changes. If you encounter problems incorporating this into your PlayCanvas project please contact us on the forums.
## Attribution
input_hmd.js contains an modified version of the WebVR Polyfill by Boris Smus. Modified Version. Original Version.