hiukim / mind-ar-js

Web Augmented Reality. Image Tracking, Face Tracking. Tensorflow.js
MIT License
2.24k stars 417 forks source link

How to get the mark targets' position? #85

Closed divowu closed 2 years ago

divowu commented 2 years ago

Thank you for sharing this great work!

I tried to get the position of the marker in the targetfound event. But I got a zero value Vector3(0,0,0) Below is my code:

marker.addEventListener('targetFound', (e) => { let pos = marker.object3D.position; // all marker targets position are zero }

Has any way to get the position?

Thank you!

hiukim commented 2 years ago

top of my head, I'm not sure. maybe it's not yet updated on targetFound. try get it 0.01 seconds later

divowu commented 2 years ago

Yes, it has delay on targetFound. I had get the position on aframe tick function.

Thanks for your reply.