VRStageParameters

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The VRStageParameters interface of the WebVR API represents the values describing the the stage area for devices that support room-scale experiences.

This interface is accessible through the VRDisplay.stageParameters property.

Properties

VRStageParameters.sittingToStandingTransform Read only
Contains a matrix that transforms the sitting-space view matrices of VRFrameData to standing-space.
VRStageParameters.sizeX Read only
Returns the width of the play-area bounds in meters.
VRStageParameters.sizeY Read only
Returns the depth of the play-area bounds in meters.

Examples

var info = document.querySelector('p');
var vrDisplay;
navigator.getVRDisplays().then(function(displays) {
  vrDisplay = displays[0];
  var stageParams = vrDisplay.stageParameters;
  // stageParams is a VRStageParameters object
  if(stageParams === null) {
    info.textContent = 'Your VR Hardware does not support room-scale experiences.'
  } else {
    info.innerHTML = '<strong>Display stage parameters</strong>'
                 + '<br>Sitting to standing transform: ' + stageParams.sittingToStandingTransform
                 + '<br>Play area width (m): ' + stageParams.sizeX
                 + '<br>Play area depth (m): ' + stageParams.sizeY
  }
});

Specifications

Specification Status Comment
WebVR 1.1
The definition of 'VRStageParameters' in that specification.
Editor's Draft Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
sittingToStandingTransform (Yes)1 2 (Yes)553 No ? ?
sizeX (Yes)1 2 (Yes)553 No ? ?
sizeY (Yes)1 2 (Yes)553 No ? ?
FeatureAndroidChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
sittingToStandingTransform No (Yes)4 ? ? No ? ?
sizeX No (Yes)4 ? ? No ? ?
sizeY No (Yes)4 ? ? No ? ?

1. Only works on desktop in an experimental version of Chrome (other builds won't return any devices when Navigator.getVRDisplays() is invoked).

2. , this feature is behind the WebVR preference. To change preferences in Chrome, visit chrome://flags.

3. Currently only Windows support is enabled by default. Mac support is available in Firefox Nightly.

4. Currently supported only by Google Daydream.

See also

文档标签和贡献者