Nerd For Tech
Published in

Nerd For Tech

Intro to the World of Augmented Reality With Unity3D and Vuforia

Bring Your Creations to Virtual Life!

Today we’re going to go over the basics of getting augmented reality working in Unity 3D using the Vuforia AR plugin.

Download the plugin and import it into Unity. You may need to download additional plugin support — Unity will prompt you if so. Just click through the prompts and everything should load fine.

To use Vuforia you’ll need to have an account and then navigate to the License Manager screen on your developer dashboard. Click “Get Developer Key” and you’ll be greeted with this screen:

Type in a name and Confirm. The next screen will display a box with your (very long) key.

In Unity, you’ll need to put the key in the Vuforia Configuration menu:

Don’t worry, it’ll fit.

If you’ve installed everything correctly you should see a new option in the GameObject menu:

Add an AR Camera to the scene and delete the Main Camera object — the AR Camera is our main camera now. The game view has gone black, but that’s not a problem we need to worry about right now.

The next step is to add an Image Target object to the scene.

This object will provide the reference for the AR projection of whatever objects we place within it in the Hierarchy. We need a high-definition image printed out, on hand here in reality. Any image will do, but Vuforia provides a sample set of images that work very well. The digital version of the image will become the texture of the Image Target object.

Simply drag your image into this box, and you’ll be set. We can test it out by placing a primitive cube as a child of the Image Target object.


Okay, but that’s kinda boring. Let’s try out a fun little script I made to create objects in a rotating helix pattern. It requires two Spawner objects (can be any kind of object) and a prefab Cube to instantiate. I made two cubes with different materials, and two spawners (rotated -180 from one another), so I got a rotating double helix effect.

Here’s the script:

I’m essentially following the formula for a helix, which is:

x(t) = r cos(t), y(t) = r sin(t), z(t) = c t
Thanks, Wolfram Alpha

So, to convert this equation into code:

  • we swap y and z (because math uses the z-axis for up and down, and Unity uses the y-axis for up and down)
  • t becomes i (for the number of iterations in the for loop)
  • r becomes a _radius variable for the x and z-axes
  • c becomes a _curve variable for the y-axis

And here’s the result:


Tomorrow I’ll be using Vuforia and Unity 3D to create an educational app about anatomy.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Micha Davis

Micha Davis

Unity Developer / Game Developer / Artist / Problem Solver