Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

location-based Ar: position is not accurate

I'm using ar.js/a-farme to put GPS entities My problem is that the position of the entities is not accurate and it is moving with me (not stable). even that the distance between them is 1346m it looks like they are so close. And I make a pipe link between two GPS entities so due to the bad position the pipe looks so small that it should be. how it looks on my mobile browser

this is my code to create the egps entity:

private createEntity(element: any): any {
    const gpsEntity: any = document.createElement('a-entity');
    gpsEntity.setAttribute('id', element.id);
    gpsEntity.setAttribute('gps-entity-place', 'latitude:' + element.Latitude + '; longitude:' + element.Longitude);
    return gpsEntity;
  }
like image 459
s bs Avatar asked Dec 18 '25 02:12

s bs


1 Answers

Check this sample (with your desired lat/long) to make sure your device orientation is okay:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Location-based AR.js demo</title>
    <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/aframe-look-at-component.min.js"></script>
    <script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js"></script>
  </head>

  <body style="margin: 0; overflow: hidden;">
    <a-scene
      vr-mode-ui="enabled: false"
      embedded
      arjs="sourceType: webcam; debugUIEnabled: false;"
    >
      <a-text
        value="This content will always face you."
        look-at="[gps-camera]"
        scale="50 50 50"
        gps-entity-place="latitude: <add-your-latitude>; longitude: <add-your-longitude>;"
      ></a-text>
      <a-camera gps-camera rotation-reader> </a-camera>
    </a-scene>
  </body>
</html>

if you can see the text "This Content always face you" and while you rotate your device , it stays in it place , it means that your GPS + Device Orientation works fine . otherwise there is a problem with your gps (inaccurate gps) or your devie orientation ( website doesn't have access to it). please let me know!

like image 143
amirhossein.razlighi Avatar answered Dec 21 '25 11:12

amirhossein.razlighi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!