@galacean/engine-xr-webxr
TypeScript icon, indicating that this package has built-in type declarations

1.2.0-alpha.0 • Public • Published

Installation

@galacean/engine-xr-webxr is one of the implementation backends of xr. If your XR application interface is WebXR standard, please introduce this package.

To install, use:

npm install @galacean/engine-xr-webxr

This will allow you to import engine entirely using:

import { WebXRDevice } from "@galacean/engine-xr-webxr";
import { XRHitTest, XRSessionMode } from "@galacean/engine-xr";

Usage

import { WebXRDevice } from "@galacean/engine-xr-webxr";
import { XRHitTest, XRSessionMode } from "@galacean/engine-xr";

// Create engine by passing in the HTMLCanvasElement
WebGLEngine.create({
  canvas: "canvas",
  xrDevice: new WebXRDevice(),
}).then((engine) => {
  // Users need to actively click the button to enter XR
  XRButton.onClick = function () {
    this.engine.xrManager.enterXR(XRSessionMode.AR).then(
      () => {
        console.log("Enter AR");
      },
      (error) => {
        console.log("Not supported AR", error);
      }
    );
  };
});
......

/@galacean/engine-xr-webxr/

    Package Sidebar

    Install

    npm i @galacean/engine-xr-webxr

    Weekly Downloads

    47

    Version

    1.2.0-alpha.0

    License

    MIT

    Unpacked Size

    1.9 MB

    Total Files

    20

    Last publish

    Collaborators

    • chengkong.zxx
    • imchenjian
    • ruimeng.su
    • yinjie
    • yiqi
    • jujie
    • luzhuang
    • husong
    • mrkou47
    • johanzhu
    • zhuxudong
    • zhanyingwei
    • gl3336563
    • eyworldwide