This is an open-source A-Frame component which allows to do visual positioning on the web, written in Three.js.
In order to use the component one should:
The component has the following attributes:
In order to make the component work the following sample could be used:
<!DOCTYPE html>
<html lang="en">
<head>
<title>A-Frame Component: Web VPS using Immersal</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="https://aframe.io/releases/1.4.1/aframe.min.js"></script>
<!-- Immersal Configuration, component and stylesheet -->
<script src="https://github.com/akbartus/A-Frame-Component-Web-VPS/raw/main/js/sdkconfig.js"></script>
<script src="https://github.com/akbartus/A-Frame-Component-Web-VPS/raw/main/js/vps-component.js" type="module"></script>
<link type="text/css" rel="stylesheet" href="https://github.com/akbartus/A-Frame-Component-Web-VPS/blob/main/css/main.css">
</head>
<body>
<!-- This is necessary to make DOM overlays work -->
<div id="overlay">
<span id="lochelp">Tap to localize</span><br />
<span id="locinfo">Successful localizations: 0/0</span>
</div>
<!-- END -->
<a-scene vr-mode-ui="enabled: false">
<a-entity webvps="pointCloudSize: 0.05; modelURL: example.glb; token: abcdefghijklmnopqrstuv; mapID: 99999; mapType: 0" visible="false"></a-entity>
</a-scene>
<!-- This is necessary -->
<div id="mapview">
<div id="canvas-parent"></div>
</div>
<!-- END -->
</body>
</html>
After entering camera mode (inside AR), direct your camera at the location you created your map and tap once on the screen. This will trigger localization of the point cloud and you should see the point cloud and/or GLTF model you loaded. Please note the counter for successful localizations at the top of the screen.
The project is powered by AFrame and Three.js.
It works on Android Chrome, and you should have the chrome://flags/#webxr-incubations set to 'enabled' if Chrome ver. is below 113. The latest chrome browsers have webxr incubations by default. iOS devices, unfortunately, are not supported for now.