Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
aframe-anchored
Advanced tools
A component that supports anchoring of a single container entity in an A-Frame scene.
When a container entity is anchored, it remains in the same place in real-world space, regardless of changes to the scene origin.
If the anchoring is persistent, this position is maintained between sessions (unless browser data is cleared).
Open the scene on a VR headset and enter AR.
On a Meta Quest hold the Meta / Oculus button to reset the scene origin. The anchored components in the scene (the sphere, cube, cylinder and plane) should stay in a fixed position, even though the scene origin has moved. The text panel in the background is not anchored, so you should see that move.
Press A to toggle anchoring off & on again. When anchoring is off, the green plane turns white, and the shapes will not stay in a fixed position when you reset the scene origin.
Add the anchored
component to a container entity within your scene that you want to anchor.
Note that:
<a-scene>
You will also need to configure some required web XR features on the scene like this:
<a-scene webxr="requiredFeatures: anchors,local-floor">
And if you want AR mode to be available from A-Frame 1.5 onwards, you also need the following config on your scene:
vr-mode-ui="enterAREnabled: true; enterVREnabled: false"
An anchored container is anchored in whatever real-world position it first appears in, the first time the user enters AR.
This means that the user does not have control over where it is anchored. There are two ways to give the user control over the position entities are anchored in.
unAnchor()
and reAnchor()
API calls to un-anchor the container, re-position it as needed, and then re-anchor it. The demo scene demonstrates this technique, using the A button on the right controller to un-anchor and re-anchor the container.Property | Description | Default |
---|---|---|
persistent | Persistent anchors are saved when the page is refreshed or closed. A non-persistent anchor only lasts as long as the current webXR session. Changing this setting after the entity has been anchored () | true |
debug | Enable console logs for debugging | false |
Method | Description | Parameters |
---|---|---|
unAnchor(resetPosition) | Unanchor the container so it no longer has a fixed real-world position and orientation, but instead moves with the scene origin. | resetPosition - if true, the container position and orientation are reset to the scene origin. If false, the container is left in its previous position, relative to the scene origin. |
reAnchor() | Re-anchor the container to a fixed real-world position and orientation. | none |
Can't anchor the whole scene
Only one anchor per scene
Via CDN
<script src="https://cdn.jsdelivr.net/npm/aframe-anchored@0.0.1/dist/anchored.min.js"></script>
Or via npm
npm install aframe-anchored
See "Demo" above
Thanks to the team at Meta for the Reality Accelerator Toolkit (RATK) for THREE.js, which this component builds upon.
FAQs
Anchor A-Frame scene
The npm package aframe-anchored receives a total of 1 weekly downloads. As such, aframe-anchored popularity was classified as not popular.
We found that aframe-anchored demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.