-
Notifications
You must be signed in to change notification settings - Fork 2
/
LocationBasedAR.html
36 lines (34 loc) · 1.35 KB
/
LocationBasedAR.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<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>
<script>
window.onload = () => {
navigator.geolocation.getCurrentPosition((position) => {
console.log(position);
document.querySelector('a-text').setAttribute('gps-entity-place', `latitude: ${position.coords.latitude}; longitude: ${position.coords.longitude};`)
document.querySelector('a-text').setAttribute('value', `latitude: ${position.coords.latitude}; longitude: ${position.coords.longitude};`)
});
}
</script>
</head>
<body style="margin: 0; overflow: hidden;">
<a-scene
vr-mode-ui="enabled: false"
embedded
arjs="sourceType: webcam; debugUIEnabled: false;"
>
<a-box color="red" position="0 0 0"></a-box>
<a-text
value="No markers around"
look-at="[gps-camera]"
scale="5 5 5"
></a-text>
<a-camera gps-camera rotation-reader> </a-camera>
</a-scene>
</body>
</html>