Make sure you have:
- Node.js (version 6.0.0 or higher)
- npm package manager (version 3 or higher)
Install the ViewAR CLI
The easiest way to setup a new ViewAR application is to use the CLI. In a terminal run:
npm install -g viewar-cli
Create your first Project
Next we can create a directory and inside it initialise a new project:
mkdir my-app cd my-app viewar init
The CLI will ask you a couple of questions. In our case we want to go with the following:
- Project: React
- App ID: Pick a name you prefer ideally in a the format com.<yourname>.tutorial
- App Version: continue by pressing enter
- Tracker: Use space to select and enter to complete the tracker selection.
- Choose ARKit if you have an iPhone
- Choose ARCore if you have an Android Phone
In order to start the development server run:
npm run start:mock
Since we are building an AR application, it is important for this example that you started the mocked server. Otherwise the web 3D engine would be started, which would collide with the 3D engine on a phone.
Next you need to setup your phone. While the mock mode allows you to develop the UI quickly using mocked tracking events, especially for the first try it's more fun using a real phone.
Download the ViewAR SDK App either from the
- Apple Store https://itunes.apple.com/us/app/viewar-sdk/id1097511807
- Google Play Store https://play.google.com/store/apps/details?id=com.viewar.sdk
Make sure that your phone and computer are in the same local network.
Next start the app, switch to LAN Development Mode and fill the fields with
- Your App ID
- Version can be empty
- IP and port of your mocked server