Time for action – creating a simple augmented reality app
For this next example, we are going to build an AR viewer into the compass app created in a previous example. The app will add a button that will take the current compass reading as a bearing to follow. The AR view will then be shown and the bearing tracked on the viewer. The bearing will scroll across the view as you move the device through the correct bearing.
Code will be added that will simulate the AR experience when the app is run on the simulator.
This example is available for download or browse at https://github.com/myleftboot/chapter-7-compass/tree/AR. To create a simple augmented reality app, perform the following steps:
Continuing from the compass example created earlier in this chapter; add a button to the screen that will show the AR viewer when clicked. The
showARView
function will be defined later in this example.ARButton = Ti.UI.createButton({title: 'Follow bearing in AR'}); ARButton.addEventListener('click', showARView...