@0x4d/locationar

Location based Argumented Reality for three.js

Usage no npm install needed!

<script type="module">
  import 0x4dLocationar from 'https://cdn.skypack.dev/@0x4d/locationar';
</script>

README

LOCATIONAR

Simple Location based Argumented Reality library, based on the WebRTC, Geolocation, DeviceOrientation and AmbientLightSensor

Online Samples:

  1. Use Chrome
  2. goto the Compass example and see if it's working [camera is working, north in the right direction]
  3. goto the Location example and you should see a red cube 10 m in the direction of North
  4. If you don't see the cube or want to change the position click "InfoPanel" and then you can press the button GetPosition to set the position of the cube to your current position and offset it with the +10N, +10W,... buttons Here you can also see the raw sensor data

Problems/Limentations

  • missing compass accurcy[can't find exact numbers, but up to +/- 10° on good devices, on some devices completely unuseable]
  • camera fov[different phones have different fov's and if the difference between the camera fov and the set fov is to big, the mapping for non-centered, far away objects will be distorted]
  • gps accurcy[can be a problem if the object is nearer than 20 meters]
  • to use the light ambient light sensor, you need to set the chrome flag #enable-generic-sensor-extra-classes to enabled

Documentation and Examples

Browser compability

✔️Chrome ❌Samsung Internet[Scaling doesn't work] ❌Firefox [no absolute compass] ❌UC[Source doesn't work] ❌Opera ❔Safari[can't test on apple devices]

Usage

The lib is small, only 20KB

LOCATIONAR is provided as an npm module:

npm i @0x4d/locationar

You can also download this repository and import the dist/LOCATIONAR.js file

Development and Contribution

Please see the development guide. If you are interested in contributing, it may be a good starting point to see the list of open issues on our GitHub issues page.

Acknowledgements

  • three.js awesome 3d rendering library
  • THREEAR marker based AR libary, with was used as a template for this project