Creating AR Applications with Asteroid

Asteroid is a augmented reality dev tool for creating 3D apps that react to their environment. It lets you create ARKit scenes that can be exported as Xcode projects that are ready to run on your iOS device.

Download and Install

To get started with Asteroid, all you need to do is download the Mac app. To use the optional Python scripting feature, you need a development version of python installed, which can be done via Homebrew (instructions here).

For exporting to iOS, you will need XCode 9 or above, and a device that supports ARKit, and an iOS developer account. A slightly outdated guide to getting the right versions of these can be found here.

Importing Files and Assets

All the files to import for your Asteroid project can be dragged and dropped into a working folder. You can import your project files through the Assets pane:

  • Click “Select Working Folder” and select the folder of assets you’ve just collected.
  • After selecting the folder, click “Select Path”, and your assets will appear in Asteroid.
  • To refresh the working folder, simply re-select the working folder through the panel

Add 3D models to your project

Place and Move an Object

Asteroid has a fairly standard game engine interface. If you want to change the object’s position in the scene, change it’s X, Y, or Z coordinate values in the inspector pane.

Add Scene Lighting

Lighting, camera perspectives and 3D text are some of the other 3D objects you can add to your scene.

Add an ML Model to your project

Import

CoreML Models are automatically imported into Asteroid if they are placed in your working folder. Navigate to the Scripting folder of the assets pane, and click the ( + ) button to add an ML Model Object to your scene.

Running an ML Model

To run and test your model, select it to reveal it in the inspector panel. When you have your model and inputs selected, click the “Run Model” button at the top. Your model’s results will appear in the “Outputs” pane at the bottom.

Control Objects with a Script

With Asteroid,you can control objects in a scene through a Python script. Using the Asteroid API, you can create simulations that control and transform objects in your scene.

Track Faces and Rectangles

With the Asteroid tracker object, you can track faces and rectangles through the built-in web-camera.

Switchboard

You can connect a graphical asset, like a 3D text object to your ML Model by clicking “Switchboard”, and dragging and dropping between variables in the two object. This will make it so every frame, your model’s output is sent to the sprite’s model.

Reactions

A Reaction is a piece of functionality that notices something happening via the camera, and triggers something happening in 3D. The example below shows how to make a simple reaction to recognise yoga poses

To save and export your reaction, select the top level (Parent) item of your reaction in the Scene pane. A button titled “Make Reaction from Selected” at the bottom of the pane will highlight its text. Click that to name and save your Reaction in your preferred location.

Import into new project

When you create a new Asteroid project, you can import your saved reactions by clicking “Select Working Folder” in the Assets pane, or through the Menu bar via “File” > “Open…”. The Reaction will appear in your “Reactions” folder of the Assets pane.

Use the Terminal / API

You can also interact with the Asteroid API through Asteroid’s built-in REPL. The Asteroid client comes bundled with the Asteroid module, so you’re able to use it right away to control the objects in your scenes through a familiar command-line style interface.

Check out the scripting guide for more on what you can do with the built-in Terminal and API.

Export to iOS

Press export

Once you’ve finished making your AR scene, you can export it out as an Xcode project that’s ready to run on your iOS device!

Open Xcode Project

Just open your newly created Xcode project

…and run it on your iOS device