webarkit / ARnft

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

[Question] How can I manually start / stop marker Tracking? #262

Closed gtk2k closed 2 years ago

gtk2k commented 2 years ago

現在開発しているアプリは、特定の場面のみマーカートラッキングを行うという仕様なのですが、どのようにしてマーカートラッキングを 開始/終了 を行うのかを知りたいです。 [Edit] English translation: The app I'm currently developing is designed to perform marker tracking only in specific situations, but I would like to know how to start / end marker tracking.

kalwalt commented 2 years ago

Hi @gtk2k if i understood right you need to quit tracking and re-run it when it is necessary. The only way you have is to terminate worker see the disposeNFT function: https://github.com/webarkit/ARnft/blob/fd16f66908451c95174dacb4ee36c90c344304ff/src/ARnft.ts#L393-L395 but it lack a method to re-init the Worker so i think you need to start again ARnft. I think we need more functions for doing this, at this moment probably you need to add your new function in the codebase.

kalwalt commented 2 years ago

I will change the dispose to something like:

//pseudo code not tested
public disposeNFT(index: number) { 
     this.controllers[index].stopNFT(); 
 }

public disposeAllNFT() { 
     NFTWorker.stopNFT(); 
 } 
gtk2k commented 2 years ago

thx!

kalwalt commented 2 years ago

@gtk2k i'm working on improve the dispose of NFT markers see PR #267

gtk2k commented 2 years ago

thank you!