'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;
}
Solution 1:[1]
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!
Solution 2:[2]
This might be because of inaccurate gps data (your lat/long). simply, if your lat/long data doesn't get updated, the gps-entity moves with your camera ( because AR.js doesn't understand that you have moved to set your new location in 3D World ) If you have more questions on this, please don't hesitate to ask!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | amirhossein.razlighi |
Solution 2 | amirhossein.razlighi |