npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aframe-anchored

v0.0.1

Published

Anchor A-Frame scene

Downloads

4

Readme

anchored

Overview

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).

Demo

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.

Usage

Add the anchored component to a container entity within your scene that you want to anchor.

Note that:

  • you can't anchor the entire <a-scene>
  • you can only anchor a single container entity. That shouldn't be a problem: just make everything that you want to anchor a child of this container.

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"

Control of anchored position

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.

  • The first (most common) is to just anchor a container entity, and give the user the ability to spawn child entities of that container at a position of their choosing. Because the container remains fixed in real-world space, its children will as well, but the child entities can be placed wherever the user chooses.
  • Another alternative is to use the 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.

Schema

| 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 |

API

| 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 |

Limitations

  • Can't anchor the whole scene

  • Only one anchor per scene

Installation

Via CDN

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/anchored.min.js"></script>

Or via npm

npm install aframe-anchored

Examples

See "Demo" above

Code

anchored

Acknowledgements

Thanks to the team at Meta for the Reality Accelerator Toolkit (RATK) for THREE.js, which this component builds upon.