Sunday, October 09, 2022

How to run AR.js basic example

Git clone the project of https://github.com/AR-js-org/AR.js

The example has to run from an http server. Opening the example file in the directory won't work. Install nodejs http server

    npm install http-server -g

In your terminal, change directory to the root of AR.js, and run

    http-server

    The server is serving the html files in http://127.0.0.1:8080. Get to http://127.0.0.1:8080/three.js/examples/basic.html in your browser. Allow the page to access camera. The page will start recording you. On your phone, do a Google image search for "hiro marker".  Display the marker on your phone and place in front of the camera. The polygon animation will render on the marker.