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

AR HitTest anchor update incompatible with non-HitTest anchors #5314

Closed
hi-liang opened this issue Jun 21, 2023 · 1 comment
Closed

AR HitTest anchor update incompatible with non-HitTest anchors #5314

hi-liang opened this issue Jun 21, 2023 · 1 comment

Comments

@hi-liang
Copy link

hi-liang commented Jun 21, 2023

Description: The scene ar-hit-test component keeps a Map anchorToObject3D corresponding to previous hit-test result .

Every ar-hit-test tick, the HitTest.updateAnchorPoses function is called to try to update the pose of aforementioned object3D from the list of XRFrame.trackedAnchors . However, if a tracked anchor is not mapped from a hit-test result, such as an anchor created by the user from some other means, Map lookup will fail and object3DOptions will be undefined.

if (anchorPose) {
object3DOptions = HitTest.prototype.anchorToObject3D.get(anchor);
offset = object3DOptions.offset;
object3D = object3DOptions.object3D;
applyPose(anchorPose, object3D, offset);

Could be addressed just by adding a check for object3DOptions before attempting to access its properties and apply the pose

  • A-Frame Version: 1.4.2 1.5.0
  • Platform / Device: Any device supporting immersive-ar persistent anchors and hit-test
  • Reproducible Code Snippet or URL:
@hi-liang
Copy link
Author

@dmarcos

Here is an example with a persistent box, roughly based on the new Mixed Reality / Anchored demo:

https://succinct-quaint-mortarboard.glitch.me/

When ar-hit-test component is added to the scene (for instance if you wanted to spawn new boxes by hit-testing the XRMesh/XRplanes) this causes an exception in the above ar-hit-test component once the persistent anchor is restored:

image

gydence pushed a commit to gydence/aframe that referenced this issue Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant