'In a-frame arjs how can I add/update a-marker pattern in runtime?
I added some html buttons, and I want them to change the currently tracking a-marker-camera's pattern and track different marker. I tried accessing the a-marker-camera (in an iframe) like below and changed its url.
var marker = myFrame.contentWindow.document.getElementById("marker");
marker.setAttribute("url", this.patternUrl);
It did change the URL but it didn't really update and continue tracking the former one. Then I tried creating 'a-marker-camera' manually in runtime.
var ascene = myFrame.contentWindow.document.getElementById("scene");
var newMarker = myFrame.contentWindow.document.createElement("a-marker-camera");
newMarker.setAttribute("id", "marker");
newMarker.setAttribute("type", "pattern");
newMarker.setAttribute("url", this.patternUrl);
ascene.appendChild(newMarker);
Same as before, it did get added, and looked perfectly fine in source. But this one also didn't work. So I don't know what else I can try, or is this even possible?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
