AR-js-org / AR.js

Image tracking, Location Based AR, Marker tracking. All on the Web.
MIT License
5.44k stars 926 forks source link

How to show msg distance on location bassed image #263

Open MilosGlisovic opened 3 years ago

MilosGlisovic commented 3 years ago

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

nickw1 commented 3 years ago

@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.

MilosGlisovic commented 3 years ago

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

MilosGlisovic commented 2 years ago

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