You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>For the <em>three.js</em> version, it's recommended to import AR.js as a module and build with a bundler such as Webpack. There is an example given in the location-based section.</p>
220
220
<h2id="requirements-and-known-issues">Requirements and Known Issues</h2>
@@ -225,6 +225,7 @@ <h2 id="requirements-and-known-issues">Requirements and Known Issues</h2>
225
225
<li>You must ensure that you have matching versions of AR.js and A-Frame. AR.js 3.4.5 (the latest version) requires A-Frame 1.3.0 while AR.js 3.4.4 and below requires 1.0.4.</li>
226
226
<li>Location-based AR will not work correctly on Firefox, due to the inability to obtain absolute device orientation (compass bearing)</li>
227
227
<li>On Android/Chrome, you may <strong>encounter issues with location-based AR due to inaccuracies in compass calibration</strong> (incorrect north). This is likely to be a hardware limitation of the device.</li>
228
+
<li>On some phones you may encounter problems with locating North due to inherent miscalibrations of the device sensors. This is a known problem recognised by the three.js developers: see <ahref="https://github.com/mrdoob/three.js/issues/22654">here</a></li>
228
229
<li>Please ensure you <strong>enable high accuracy</strong> location for your selected browser on Android. Sometimes high accuracy location is turned off by default, and this will lead to an inaccurate GPS location.</li>
229
230
<li>There is currently a bug in location-based AR where the camera feed is stretched away from the centre of the screen, meaning that there is reduced accuracy in placement of objects further away from the centre. Work is ongoing to investigate this.</li>
230
231
<li>On device with multi-cameras, Chrome may have problems on detecting the right one. Please use Firefox if you find that AR.js opens on the wrong camera. There is an open issue for this.</li>
@@ -328,8 +329,8 @@ <h3 id="location-based-example">Location Based Example</h3>
<p><strong>Important!</strong> You might want to check out the new AR.js <ahref="https://github.com/AR-js-org/locar.js">LocAR</a> project if you are interested in location-based AR. This aims to provide a cleaner API, with just a single version, and more frequent updates. </p>
129
+
<p>In the future, updates on the location-based side will be focused on LocAR.</p>
130
+
<h2id="intro-to-location-based">Intro to location-based</h2>
120
131
<p><ahref="https://medium.com/chialab-open-source/build-your-location-based-augmented-reality-web-app-c2442e716564">This article</a> gives you a first glance to Location Based on AR.js.</p>
121
132
<p>It can be used for indoor (but with low precision) and outdoor geopositioning of AR content.</p>
122
133
<p>You can load places statically, from HTML or from Javascript, or you can load your data from local/remote json, or even through API calls. Choice is yours. On the article above there are all the options explained, as tutorials.</p>
<p>Location-based AR with AR.js is subject to certain limitations.</p>
142
+
<ul>
143
+
<li>Your device must have a GPS chip, accelerometer and magnetometer.</li>
144
+
<li>On some devices, the sensors may be miscalibrated, resulting in an incorrect North. See, for example, <ahref="https://github.com/mrdoob/three.js/pull/22654">this three.js issue</a>. This is unfortunately a limitation of the device. This will be investigated further in <ahref="https://github.com/AR-js-org/locar.js">LocAR</a>, for example, as to whether certain devices are consistently "out" by a certain bearing.</li>
145
+
<li>The camera feed may appear "stretched". Again the focus on fixing this will be in LocAR.</li>
146
+
</ul>
129
147
<h2id="a-frame">A-Frame</h2>
130
148
<p>AR.js offers A-Frame components to implement location-based AR. There are three variants of the components, detailed as below:</p>
131
149
<ul>
132
150
<li>
133
-
<p>The <code>new-location-based</code> components. These have been available since AR.js 3.4.0, incorporate various bug fixes, use simpler code, and provide a thin wrapper round the three.js API shown below. These are recommended for most uses, though do not support all the <ahref="../ui-events/">events</a> of the older components due to a different internal implementation. Nonetheless they the components likely to see further development - the older variants are unlikely to see further work besides bug fixes.</p>
151
+
<p>The <code>new-location-based</code> components. <strong>In most cases, these are recommended</strong>. These have been available since AR.js 3.4.0, incorporate various bug fixes, use simpler code, and provide a thin wrapper round the three.js API shown below. These are recommended for most uses, though do not support all the <ahref="../ui-events/">events</a> of the older components due to a different internal implementation. Nonetheless they the components likely to see further development - the older variants are unlikely to see further work besides bug fixes.</p>
134
152
</li>
135
153
<li>
136
-
<p>The <code>projected</code> components. These have been available since AR.js 3.3.1, use largely the same internal implementation as the classic components, and were the first to offer projection of latitude/longitude into Spherical Mercator, discussed below.</p>
154
+
<p>The <code>projected</code> components. These have been available since AR.js 3.3.1, use largely the same internal implementation as the classic components, and were the first to offer projection of latitude/longitude into Spherical Mercator, discussed below. They are generally <strong>not recommended</strong> unless you have problems with <code>new-location-based</code>.</p>
137
155
</li>
138
156
<li>
139
-
<p>The classic components, available before AR.js 3.3.1. These are similar to the <code>projected</code> components but do not offer the facility to convert between latitude/longitude and the projected coordinates used for augmented reality, which can cause problems for more specialist uses such as showing roads and paths in augmented reality.</p>
157
+
<p>The classic components, available before AR.js 3.3.1. These are similar to the <code>projected</code> components but do not offer the facility to convert between latitude/longitude and the projected coordinates used for augmented reality, which can cause problems for more specialist uses such as showing roads and paths in augmented reality. For most use cases it is preferred to use <code>new-location-based</code> but some uses, such as embedded AR scenes, only work with the classic components.</p>
<p><code>gps-new-camera</code> implements projection via the underlying AR.js three.js <code>LocationBased</code> object (see three.js documentation, below) which is responsible for the actual projection. </p>
309
327
<p><code>gps-projected-camera</code> provides similar functionality but via a different method and with some implementation differences. In <code>gps-projected-camera</code>, unlike <code>gps-new-camera</code>, the <strong>original GPS position</strong> is set as the world origin.</p>
310
328
<h2id="threejs">three.js</h2>
329
+
<p>For pure three.js (no A-Frame) it is recommended to use <ahref="https://github.com/AR-js-org/locar.js">LocAR</a>. The notes below, however, refer to the three.js version in the main AR.js repository.</p>
311
330
<p>The three.js API keeps track of your current GPS location (or allows you to set a fake location) and allows you to add three.js objects at a given latitude and longitude. It includes these classes:</p>
312
331
<ul>
313
332
<li><code>THREEx.LocationBased</code> - general manager class for the three.js location-based API.</li>
0 commit comments