VRStageParameters

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

Giao diện VRStageParameters của WebVR API đại diện cho các giá trị mô tả khu vực sân khấu cho các thiết bị hỗ trợ trải nghiệm quy mô phòng.

Note: Giao diện này là một phần của WebVR API cũ. Nó đã được thay thế bởi WebXR Device API.

Giao diện này có thể truy cập thông qua thuộc tính VRDisplay.stageParameters.

Thuộc tính phiên bản

VRStageParameters.sittingToStandingTransform Deprecated Read only Non-standard

Chứa ma trận biến đổi các ma trận nhìn trong không gian ngồi của VRFrameData sang không gian đứng.

VRStageParameters.sizeX Deprecated Read only Non-standard

Trả về chiều rộng của giới hạn khu vực chơi tính bằng mét.

VRStageParameters.sizeY Deprecated Read only Non-standard

Trả về chiều sâu của giới hạn khu vực chơi tính bằng mét.

Ví dụ

js
const info = document.querySelector("p");
let vrDisplay;

navigator.getVRDisplays().then((displays) => {
  vrDisplay = displays[0];
  const stageParams = vrDisplay.stageParameters;
  // stageParams is a VRStageParameters object

  if (stageParams === null) {
    info.textContent =
      "Your VR Hardware does not support room-scale experiences.";
  } else {
    info.innerText = `
Sitting to standing transform: ${stageParams.sittingToStandingTransform}
Play area width (m): ${stageParams.sizeX}
Play area depth (m): ${stageParams.sizeY}`;
    info.insertBefore(
      document.createElement("strong"),
      info.firstChild,
    ).textContent = "Display stage parameters";
  }
});

Thông số kỹ thuật

Giao diện này là một phần của WebVR API cũ đã được thay thế bởi WebXR Device API. Nó không còn trên đường trở thành tiêu chuẩn.

Cho đến khi tất cả các trình duyệt triển khai WebXR APIs mới, khuyến nghị sử dụng các framework như A-Frame, Babylon.js, hoặc Three.js, hoặc polyfill để phát triển các ứng dụng WebXR hoạt động trên tất cả các trình duyệt.

Tương thích trình duyệt

Xem thêm