-
Notifications
You must be signed in to change notification settings - Fork 19
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
UAs must retain expando XRAnchor attributes in future XRFrame.trackedAnchors sets #35
Comments
I am thinking instead of custom extra data such as |
The main value of the for(const anchor of previousFrameAnchors) {
if(!trackedAnchors.has(anchor)) {
// Handle anchor tracking loss - `anchor` was present
// in the present frame but is no longer tracked.
}
}
Yes, I had this behavior in mind when designing the API, although it may not be explicitly stated anywhere in the spec. The snippet pasted above is implying that the anchor object is persistent for as long as it's present in As for UUID, it was discussed in #18 - please take a look and reopen the issue if you disagree with the resolution. |
I thought about it for a bit and it occurred to me that the way the specification draft is written, it is already explicit that the anchor objects are the same ones - the only objects that can appear in |
Given this approach of
XRAnchor
only representing explicit app-created freespace anchors, having a list of tracked anchors seems harmless to me.XRFrame.trackedAnchors
does feel lower value than is implied by the code in the anchors explainer, as there is no per-anchor ID or other data beyond theanchorSpace
to tie a givenXRAnchor
back to any set of app content. The app itself will need to remember for each anchored scene object it creates which anchor that object is attached to... at which point the app could just loop over its own list of those anchors and poll forisLost
or such.Note that the
for
loop overtrackedAnchors
at the bottom stops after getting eachXRAnchor
'spose
- it's not clear what the next line of code would be for the app to make productive use of thatpose
, unless it was already maintaining an equivalenttrackedAnchors
map from scene node to anchor itself:The primary way I could see an app productively using
trackedAnchors
is if it set its own additional attribute on eachXRAnchor
to store the list of its root scene objects whose poses need to be updated each frame:This seems like a reasonable pattern, although it would rely on a promise that the UA will return the same
XRAnchor
instance on subsequent frames whenXRFrame.trackedAnchors
is enumerated, rather than returning a new equivalentXRAnchor
instance that lost that extra data.I'll file a new issue around specifying that the UA must retain any extra data on an
XRAnchor
when it's enumerated moving forward.Originally posted by @thetuvix in #11 (comment)
The text was updated successfully, but these errors were encountered: