webarkit / ARnft

A small javascript library for WebAR with NFT
GNU Lesser General Public License v3.0
220 stars 54 forks source link

Get current tracked NFT in Multi NFT Example #281

Open snmabaur opened 2 years ago

snmabaur commented 2 years ago

I'm starting to develop an application with your library where I need to use multi nft markers... My problem is, that I don't get the name of the currently tracked nft even though I'm trying it out with your arNFT_multi_example.html and I see the event listeners there

document.addEventListener('getMatrixGL_RH-' + nft.uuid + '-pinball', function() { console.log('this is pinball!!'); })

This console log is not working... is there any other way to track with nft is currently scanned? When I scann the pinball image I see [info] Tracked page 20470720 (max 0). inside the console and [webarkit-info:]Tracking lost. -3 when I remove the pinball image so I guess the tracking is working and I also see the red cube over the pinball image... It's just not working with the EventListener

Thanks

kalwalt commented 2 years ago

I'm starting to develop an application with your library where I need to use multi nft markers... My problem is, that I don't get the name of the currently tracked nft even though I'm trying it out with your arNFT_multi_example.html and I see the event listeners there

document.addEventListener('getMatrixGL_RH-' + nft.uuid + '-pinball', function() { console.log('this is pinball!!'); })

This console log is not working... is there any other way to track with nft is currently scanned? When I scann the pinball image I see [info] Tracked page 20470720 (max 0). inside the console and [webarkit-info:]Tracking lost. -3 when I remove the pinball image so I guess the tracking is working and I also see the red cube over the pinball image... It's just not working with the EventListener

Thanks

Sorry @snmabaur for this, i think i did some changes in the past that break the example. I need to check again it, but i have not so much time now. Consider that ARnft send events messages to ARnft-threejs and if it can track, as consequence messages are received. Maybe you can try to attach an addEventListener to window object instead of document, but i can not assure of this.