Search documentation

Find pages, sections, and content across all docs.

WavedashDocs

WebXR

Wavedash games can start immersive VR and AR sessions with the WebXR Device API. No setup is needed.

The game frame is granted the xr-spatial-tracking permission, so the WebXR Device API works with no setup.

Starting a session

Browsers only start an immersive session from a user gesture, so call requestSession() from a click handler in your game:

if (await navigator.xr?.isSessionSupported("immersive-vr")) {
  enterButton.hidden = false;
  enterButton.addEventListener("click", async () => {
    const session = await navigator.xr.requestSession("immersive-vr"); // or "immersive-ar"
    // Hand the session to your engine, e.g. renderer.xr.setSession(session) in three.js
  });
}

Your game doesn't receive input while a Wavedash purchase overlay is open, so players can't start a session until it closes.

Browser support

  • Meta Quest Browser supports immersive-vr and immersive-ar. It's the main target.
  • Chrome on Android supports immersive-ar on ARCore devices.
  • Safari on visionOS supports immersive-vr but not immersive-ar.
  • Safari on iOS has no WebXR. Keep a flat-screen mode.

Engines

  • three.js, Babylon.js, and Godot 4 web exports support WebXR natively.
  • Unity doesn't support WebXR in WebGL builds. Community packages such as WebXR Export add it.

Assets loaded from other servers still need the cross-origin isolation headers.