Dear 8th Wall Technical Support,
I’m currently developing two WebAR projects using the 8th Wall platform and A-Frame. Each project supports two gameplay modes and allows the user to switch between them via a button. However, I’m encountering two technical issues, I already published the project:
Gameplay Overview:
-
Gameplay 1:
The 3D model is placed on a horizontal ground plane. Players must tilt their phones to find and tap a hidden “Mark” on the model’s surface to reveal the story text. -
Gameplay 2:
The 3D model is anchored on the user’s palm. Players tilt their hand to change the model’s opacity; when the model becomes fully transparent, the story text inside is revealed. -
Gameplay 3:
The 3D model flies around in the sky. Players must aim steadily at the model for ~5 seconds to “unlock” the memory and display the story text.
Project 1: Switching between Gameplay 1 and Gameplay 3
Issue:
When switching from Gameplay 1 to Gameplay 3 and uploading a new image (which triggers a MeshyAI 3D model), two models appear:
-
One remains at the original grounded position (from Gameplay 1)
-
Another flies around in the sky (Gameplay 3 behavior)
Suspected Cause:
It seems that the previously loaded components (or entities) are not being fully removed or cleaned up, even after calling removeAttribute()
and clearing innerHTML
.
Project Link: Niko_GameSwap_1
Project 2: Switching between Gameplay 1 and Gameplay 2
Issue:
Gameplay 1 loads and runs correctly. But when switching to Gameplay 2, the photo upload triggers a network error (while it works when Gameplay 2 is loaded directly).
Suspected Cause:
Likely due to JavaScript component registration conflicts, or issues with shared input elements and asynchronous timing between gameplay modes.
Project Link: Niko_GameSwap_2
Technical Context:
-
Each gameplay registers its own A-Frame component:
meshy-markpoint
,meshy-revealhand
, andmeshy-flyaround
. -
Switching is handled via a shared
swap-gameplay.js
, where we use.setAttribute()
and.removeAttribute()
to attach/detach gameplay components. -
The DOM structure includes shared
<a-entity id="orbEntity">
for Gameplay 1 & 2, and<a-entity id="skyContainer">
for Gameplay 3. -
Photo uploads are triggered from shared input elements, using base64 image transfer to a Flask backend via Ngrok, which in turn calls OpenAI and MeshyAI APIs to generate story text and 3D models.
Questions:
-
What’s the recommended way to fully clear a component and its internal effects (e.g. child entities, animation state, event listeners) before switching modes in A-Frame?
-
Is there a best practice to reload or reinitialize A-Frame components dynamically ?
-
What’s the proper way to manage shared UI elements like
<input>
and<button>
across multiple gameplay scripts, especially when switching logic is involved? -
Do you have an official example or template that demonstrates clean component switching in 8th Wall WebAR projects?
Thank you very much for your guidance. I really appreciate any advice you can provide!