Use WebVR today, without requiring a special browser build.
We got reports (#307) of polyfill breakage (thanks @dustinkerstein!) on newer versions of Chrome. In Chrome m65, a regression to devicemotion
events doesn't provide rotationRate
, breaking the head tracking in the polyfill, and m66 switching DeviceMotionEvent.rotationRate
values to use degrees instead of radians to be aligned with the spec. Separately there's another issue where deviceorientation
/devicemotion
events are fired at 5-10hz in Chrome m65/m66. This doesn't consistently occur.
This release includes an updated CardboardVRDisplay with fixes for the devicemotion
Chrome m65 regression by using a deviceorientation
fallback (https://github.com/immersive-web/cardboard-vr-display/commit/d770e01f1df2a59f6f39f43aaf3a469769dbc465)
and does not take advantage of sensor fusion, and also includes a fix to handle Chrome m66's rotationRate
unit change (https://github.com/immersive-web/cardboard-vr-display/commit/75a6d51ac8c8fab3f2aa648bddea5a59146bb65a). The issue of lowered device motion rate in Chrome m65/m66 can be tracked at crbug.com/819413. With Sensor API (#10) now being supported instead of devicemotion
, one temporary workaround is enabling sensors. Read here to learn more about enabling Sensor API.
TLDR: If seeing issues in Chrome m65 and later versions, please update to the latest version of the WebVR Polyfill. There may be some stuttering in the pose due to platform issue on m65/m66, which can be solved locally by enabling chrome://flags/#enable-generic-sensor
, and there could be a browser update to fix the low frequency rate of device events. Changes have been sent downstream to A-Frame (https://github.com/aframevr/aframe/pull/3453). If upgrading from 0.9.x
to 0.10.x
, be sure to call the WebVRPolyfill
constructor with your configuration object rather than using window.WebVRConfig
(example).
devicemotion
(#10)vrdisplayconnect
on the polyfilled VRDisplay only if there are no native displays (#303)requestAnimationFrame
incase consumer overwrites, fixes WebVR Unity Exporter issue (#308)This is one of the largest updates for the Polyfill in quite some time! Most changes are refactoring, focusing on pulling pieces out to make it easier to scope, test, and work on future changes as the WebXR Device API approaches, so we can be more confident in changes without breaking edge cases. The polyfill was also scope creeping a bit, doing more than just providing a stable API surface for developers to target, and many of these features have been removed that are better off in userland and on a per-project basis.
new window.WebVRPolyfill(options)
. Previously this was handled by defining options on a global window.WebVRConfig
object, and the polyfill would instantiate itself immediately, or require the user to call window.InitializeWebVRPolyfill()
if DEFER_INITIALIZATION
was set. DEFER_INITIALIZATION
has been removed, the polyfill no longer instantiates itself, and options are passed into the constructor rather than relying on a global object. This makes it easier to work with in module environments and other JS build systems.InstallWebVRSpecShim()
has been removed.navigator.vrEnabled
property has been removed. This was used to indicate if displays exist, which can be done by checking the return value of getVRDisplays()
.MouseKeyboardVRDisplay
has been removed. This provided a monoview VRDisplay with some primitive controls for a 3DOF experience. This is better handled with custom controls or OrbitControls depending on the experience. MOUSE_KEYBOARD_CONTROLS_DISABLED
option has been removed. This means on desktop, the only displays that can exist are native, so user code should handle when no displays are found.MouseKeyboardVRDisplay
, and the WebXR Device API only allowing one display rather than an array of displays, ALWAYS_APPEND_POLYFILL_DISPLAY
has been removed. A new option, PROVIDE_MOBILE_VRDISPLAY
has been created to provide a CardboardVRDisplay
when on mobile and the native API exists but no native displays exists. true
by default, this means that the polyfill is always injected on mobile when enabled, since we won't know immediately if any native displays exist. FORCE_ENABLE_VR
has been removed. This always provided a CardboardVRDisplay
, even on desktop, used mostly for debugging purposes.TOUCH_PANNER_DISABLED
has been removed. This is not a part of the WebVR 1.1 spec.DEBUG
option. Previously this was triggered by a ?debug
query parameter, which caused issues with other environments.main
package.json entry now points to the built output rather than src/node-entry
. This lets us take advantage of our build system and not require consumers to handle any transformations implemented.WebVRPolyfill
methods and properties have been removed: isFullScreenAvailable
, isCardboardCompatible
, isMobile
, NativeVRFrameData
, getVRDevices
, enableDeprecatedPolyfill
, isDeprecatedWebVRAvailable
, isWebVRAvailable
.Support for new WebVRConfig
properties:
YAW_ONLY
MOUSE_KEYBOARD_CONTROLS_DISABLED
TOUCH_PANNER_DISABLED
devicemotion
events with a complementary filter.resetSensor
on the fusion device.Main feature added in this release is head tracking orientation prediction. Many browsers provide DeviceOrientationEvents with motion-to-photon latency of >150ms. This latency is very sickness inducing. By predicting head tracking into the future based on DeviceMotionEvent, we provide much more responsive head tracking.