Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
MascheroniNatan committed Oct 24, 2024
1 parent 5920440 commit 2bfc54c
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>AR.js A-Frame Location-based</title>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<script type='text/javascript' src='https://raw.githack.com/AR-js-org/AR.js/master/three.js/build/ar-threex-location-only.js'></script>
<script type='text/javascript' src='https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js'></script>
</head>
<body>
<a-scene vr-mode-ui='enabled: true' arjs='sourceType: webcam; videoTexture: true; debugUIEnabled: true' renderer='antialias: true; alpha: true'>
<a-camera gps-new-camera='gpsMinDistance: 5'></a-camera>
<a-entity material='color: red' geometry='primitive: box' gps-new-entity-place="latitude: 45.60139; longitude: 8.84809" scale="10 10 10"></a-entity>
</a-scene>
<script>
// Mostra un alert con la posizione dell'utente
document.querySelector('a-camera').addEventListener('gps-camera-update-position', function (event) {
const { latitude, longitude } = event.detail.position;
alert(`La tua posizione è:\nLatitudine: ${latitude}\nLongitudine: ${longitude}`);
});
</script>
</body>
</html>
<html lang="en">
<head>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/ar.js/2.0.0/aframe/build/aframe-ar.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
</head>
<body style="margin: 0; overflow: hidden;">
<a-scene embedded arjs="sourceType: webcam;">
<a-entity gps-entity-place></a-entity>
<a-camera gps-camera="simulateAltitude: false;"></a-camera>
</a-scene>

<script>
// Mostra un alert con la posizione dell'utente
document.querySelector('a-camera').addEventListener('gps-camera-update-position', function (event) {
const { latitude, longitude } = event.detail.position;
alert(`La tua posizione è:\nLatitudine: ${latitude}\nLongitudine: ${longitude}`);
});
</script>
</body>
</html>

0 comments on commit 2bfc54c

Please sign in to comment.