Skip to content

Conversation

@Maksims
Copy link
Collaborator

@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

@mvaligursky mvaligursky added enhancement Request for a new feature area: xr XR related issue labels Nov 7, 2023
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
@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

area: xr XR related issue enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebXR Persistent Anchors

2 participants