-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5920440
commit 2bfc54c
Showing
1 changed file
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |