Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebXR DOM Overlay #2614

Merged
merged 2 commits into from
Dec 29, 2020
Merged

WebXR DOM Overlay #2614

merged 2 commits into from
Dec 29, 2020

Conversation

Maksims
Copy link
Contributor

@Maksims Maksims commented Dec 14, 2020

Implements WebXR DOM Overlays Module Specs. It allows using regular DOM elements in AR session.

This API is already available today in release Chrome on Android, and no flags/origin trials are required for it.

New APIs:

// pc.XrManager
app.xr.domOverlay // interface to access dom overlay

// pc.XrDomOverlay
domOverlay.supported // true if dom overlay is supported
domOverlay.available // true if dom overlay is currently available, this is only possible if supported, during active AR session and if root were provided before the session start
domOverlay.state // string of DOM overlay state, which indicates how the root element is rendered by the browser, possible options are: screen, floating, head-tracked
domOverlay.root // DOM element to be used as the root for overlay

Example:

this.app.xr.domOverlay.root = element;
this.app.xr.start(camera, pc.XRTYPE_AR, pc.XRSPACE_LOCALFLOOR);

To prevent Input Sources firing select events behind DOM elements, a new event is available:

someElement.addEventListener('beforexrselect', function (evt) {
    evt.preventDefault();
});

Test project: https://playcanvas.com/project/747233/overview/webxr-ar-dom-overlay
Test Demo: https://playcanv.as/p/S01LYTIU/

I confirm I have signed the Contributor License Agreement.

@Maksims Maksims changed the title WebXR Dom Overlay WebXR DOM Overlay Dec 14, 2020
@willeastcott willeastcott self-assigned this Dec 29, 2020
@willeastcott willeastcott requested review from willeastcott and a team and removed request for willeastcott December 29, 2020 14:18
@willeastcott willeastcott self-requested a review December 29, 2020 15:26
@willeastcott willeastcott merged commit ae675e3 into playcanvas:master Dec 29, 2020
@Maksims Maksims deleted the webxr-dom-overlay branch January 22, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: xr XR related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants