I have an AR scene with several markers that show different 3d models when activated. Like this:
<a-scene embedded arjs>
<a-marker markerhandler preset="custom" type="pattern" url="Target1.patt" id="1">
<a-image src="image1.jpg"></a-image>
</a-marker>
<a-marker markerhandler preset="custom" type="pattern" url="Target2.patt" id="2">
<a-image src="image2.jpg"></a-image>
</a-marker>
<a-entity camera></a-entity>
</a-scene>
And the associated script:
<script>
AFRAME.registerComponent('markerhandler', {
init: function () {
this.el.sceneEl.addEventListener('markerFound', (e) => {
alert(this.id); //This should show the id ("1" or "2" in the example)
})
}
});
</script>
How do I recognize which target is triggered, and get the id? I tried everything and I'm going crazy, any help is appreciated. Thank you!