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

Using spatial anchor causes scale to get overruled #5630

Closed
NoTuxNoBux opened this issue Jan 15, 2025 · 1 comment · Fixed by #5633
Closed

Using spatial anchor causes scale to get overruled #5630

NoTuxNoBux opened this issue Jan 15, 2025 · 1 comment · Fixed by #5633

Comments

@NoTuxNoBux
Copy link

Description:

I have a simple a-box with scale set to something that is not the default. If I place anchored on it and call createAnchor as per the documentation, my scale gets set back to a uniform 1.

It appears that tick in the anchored component does:

pose = frame.getPose(this.anchor.anchorSpace, refSpace);
object3D.matrix.elements = pose.transform.matrix;
object3D.matrix.decompose(object3D.position, object3D.rotation, object3D.scale);

This seems to overrule the entire matrix of the object, including the scale. I verified this by placing const oldScale = object3D.scale.clone(); before the code and object3D.scale.copy(oldScale); after to restore it.

  • A-Frame Version: 1.6.0
  • Platform / Device: Meta Quest 3
  • Reproducible Code Snippet or URL: /
@mrxz
Copy link
Contributor

mrxz commented Jan 20, 2025

Spatial anchors represent a space, which means the position, rotation and scale are all defined by it. This way anything placed within that space is relative to the anchor. But the anchored component is documented as anchoring the entity it's applied to, so it actually makes sense to retain the scale.

Opened a PR to fix this issue, see #5633

As a workaround you could either introduce one level of nesting, placing your <a-box> inside an <a-entity> that has the anchored component. Or you can use the width, height and depth properties of a-box instead of setting its scale.

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

Successfully merging a pull request may close this issue.

2 participants