Passing World Tracking data between scenes

Hi,

I’m working on an aframe cloud editor based project with some relatively complex and asset heavy content targets. In order to keep things optimized, we’ve planned the infrastructure to utilize multiple scenes (one for each section of the experience). We’re trying to smooth out the transition as much as possible between scenes, and are looking to see if it’s possible at all to share world tracking data between the AR scenes so we can save the world position once initially placed, and reliably use that position for auto-placement of newly loaded scenes.

Thanks

The only way would be to reuse the same <a-scene>. Every time the xrweb component is removed/added to the scene or DOM, the AR engine will reinitialize.

Depending on the complexity of your project, you might be able to group scenes and toggle visibility:

<a-scene xrweb>
  <a-entity id="scene1">
    ...
  </a-entity>
  <a-entity id="scene2" visible="false">
    ...
  </a-entity>
</a-scene>

Or you could do something similar, but dynamically remove/add entities using JavaScript instead of toggling the visibility.

1 Like

Hmm, I think if we could remove/add entities that’d probably be the ideal scenario in order to keep the entity count down. Is there a specific method you’d recommend for adding entities with components in bulk? Like for example, would InsertAdjacentHTML with an HTML template work, or would it need to be more like creating the entities and adding components/values entirely in JS (createEntity(), then setAttribute() for all the components, etc)?