AR.js icon indicating copy to clipboard operation
AR.js copied to clipboard

How to show msg distance on location bassed image

Open MilosGlisovic opened this issue 3 years ago • 4 comments

Can you show the code or example how to get distance text like here? image

MilosGlisovic avatar May 01 '21 20:05 MilosGlisovic

@MilosGlisovic to get the marker and text to appear together, you need to create a compound <a-entity> containing both text and a marker as child entities (see the final peakfinder example in the location-based tutorial). To get the distance between the current location and another, you can use the Haversine formula, you can use the computeDistanceMeters() method of gps-camera or gps-projected-camera to calculate this. Each object passed as an argument to this method should have latitude and longitude properties.

Hope this helps.

nickw1 avatar May 02 '21 09:05 nickw1

Thank you. I hope that be fine. I worked something with msgDistance. Thanks

MilosGlisovic avatar May 10 '21 16:05 MilosGlisovic

Hi @MilosGlisovic Can you please share with me some code about it? Thanks

alchemist0404 avatar May 20 '21 07:05 alchemist0404

Sorry I didn't see the message. I want someting like this: https://www.youtube.com/watch?v=biCKHVefIe8 Create a-image and a-text like child element, and in a-text value put the distanceMsg attribute, but my code dont work

MilosGlisovic avatar Sep 13 '22 18:09 MilosGlisovic