@galacean/engine-xr
v1.3.24
Published
`@galacean/engine-xr` is the implementation layer of XRManager and is a necessary package for developing XR applications.
Downloads
849
Maintainers
Keywords
Readme
Installation
@galacean/engine-xr
is the implementation layer of XRManager and is a necessary package for developing XR applications.
To install, use:
npm install @galacean/engine-xr
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);
}
);
};
});
......