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 Persistent Anchors #5779

Merged
merged 15 commits into from
Nov 9, 2023
Merged

Conversation

Maksims
Copy link
Contributor

@Maksims Maksims commented Nov 1, 2023

Fixes #5698

This PR adds new APIs to Anchors, that allows to persist them across sessions within page origin.
Meta Quest 3 has support of such feature.

Through my quick testing, atm Quest 3 supports up to 8 persistent anchors per origin.

Test link: https://examples.playcanvas.meta.space/#/xr/ar-anchors-persistent

New APIs:

// pc.XrAnchors
xr.anchors.persistence // boolean, true if persistence is supported
xr.anchors.uuids // array of string UUIDS of persistent anchors
xr.anchors.restore(uuid, (err, anchor) => { }); // restore persistent anchor
xr.anchors.forget(uuid, (err, anchor) => { }); // forget persistent anchor

// pc.XrAnchor
anchor.uuid // string or null of anchor UUID
anchor.persistent // true if anchor is persistent
anchor.persist((err, uuid) => {}); // persist an anchor
anchor.forget((err) => {}); // forget an anchor
anchor.on('persist', (uuid) => { }); // event when anchor becomes persistent
anchor.on('forget', () => { }); // event when anchor is forgotten

This PR requires this: #5778 to be merged first.

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

@mvaligursky
Copy link
Contributor

mvaligursky commented Nov 7, 2023

Can you please resolve conflicts here @Maksims
This branch has conflicts that must be resolved

Copy link
Contributor

@mvaligursky mvaligursky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid, just few small suggestions.

@mvaligursky mvaligursky merged commit 612261f into playcanvas:main Nov 9, 2023
7 checks passed
@Maksims Maksims deleted the xr-persistent-anchors branch November 9, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebXR Persistent Anchors
2 participants