webarkit / ARnft

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

Callback Examples and available APIs #151

Closed ragavendranbala closed 3 years ago

ragavendranbala commented 3 years ago

Hi, Basically I'm Unity AR developer with C# as my background. So It's feeling like I'm driving a power packed Alien Ship without a user manual (Available APIs and Intellisense). I have checked the AR-NFT-Video_Example.html file, I haven't seen any callback methods are listed on the file to handle the marker lost and found events (Maybe I'm wrong). So I have added my own lines for callbacks. It maybe wrong in some cases, But it's working fine for me for one video and marker. Kindly Add callbacks in the examples.

image

I'm requesting you to write API Documentation. So that, even peoples having less knowledge in JS and HTML (Like ME) can use this library effectively. If Possible, add me in your Slack Channel, so that i can contribute easily.

kalwalt commented 3 years ago

@ragavendranbala thank for this issue, i can understand your troubles. I didn't write any API doc because i do the most part of the code. For sure there are many things, improvements and utilities to add. We have a link to slack channel in our website, but probably is expired, you can join us at this link

kalwalt commented 3 years ago

@ragavendranbala typesctript support is on the way see PR https://github.com/webarkit/ARnft/pull/167 and jsartoolkitNFT has already it. :slightly_smiling_face:

JunkYardRobotBoy commented 3 years ago

Hi @kalwalt and @ragavendranbala Been scouring the slack channel and this repo can't seem to get the call back for the marker detection working at all. Tried:

        document.addEventListener('getMatrixGL_RH', (ev)=> {
            console.log(ev);
            console.log("FOUND MY marker");
        })

and

        document.addEventListener('matrixGLrhEvent',ev => {
                  //console.log(ev);
          console.log("FOUND MY marker");
            })

With no luck. However the marker lost function: document.addEventListener('nftTrackingLost', function (ev) { console.log(ev); console.log("lost MY marker"); }) Works fine. Any ideas?

kalwalt commented 3 years ago

Hi @JunkYardRobotBoy which ARnft version are you using?

JunkYardRobotBoy commented 3 years ago

hi @kalwalt I'm using 0.10.0

kalwalt commented 3 years ago

@JunkYardRobotBoy you should add the uuid as in this piece of code:

https://github.com/webarkit/ARnft-threejs/blob/a36b5037b8784f92d44e49c5e1933e9f73831588/src/SceneRendererTJS.ts#L90-L94

JunkYardRobotBoy commented 3 years ago

@kalwalt - legend, thank you!

got this to work: document.addEventListener('getMatrixGL_RH-' + nft.uuid, (ev) => { console.log("found marker"); }) adding it in after : sceneThreejs = new ARnftThreejs.SceneRendererTJS(config, canvas, root, nft.uuid,true);

Thanks heaps - much appreciated!

albjeremias commented 3 years ago

close,