AR Development with Vuforia — Day 1
Working with a single Image Target
In this article, we will have a look at AR using Vuforia Image Target feature. Image Targets represent images that Vuforia Engine can detect and track. These can be pictures in magazines, on posters or even back of a cereal box. Once detected, we can place whatever we have developed in its place and whereever we move the camera or mobile, the app will track it’s location based on the target. Let’s try it out.
Create a new project
Create a new 3D project and start a new scene
Download and import Vuforia Unity Package
Go to https://developer.vuforia.com/downloads/SDK and click on Add Vuforia Engine to a Unity Project or upgrade to the latest version.
You will need to register for a developer account and download the latest unity package.
Drag the downloaded package into Unity or double-click on the package in Windows Explorer and you will see the Import window.
Setting up scene
Remove the Main Camera, we won’t be needing this as we will be replacing this with a different camera. Select the Main Camera and press the Delete key.
Add a Vuforia Camera by right-clicking in the Hierarchy view > Vuforia Engine > AR Camera
Let’s now add the Image track to the scene. Right-click in the Hierarchy view and select Vuforia Engine > Image Target
In this example, we are going to use an image supplied by Vuforia, the Astronaut.
Select the Image Target and in the Inspector, under Type, choose From Database. Press Import.
Here you can decide what model you want to display when the camera detects the image target. I am going to use the Astronaut model that comes with the Vuforia Core Samples on the Unity Asset Store. I downloaded and only imported the Astronaut FBX, material and texture.
Drag the Astronaut FBX as a child of the Image Target and Scale to 0.15 across all axis, rotate on the Y 180 and drag on the material.
Depending on the camera you want to use, I needed to change the camera by selecting the ARCamera > Open Vuforia Engine Configuration > Camera Device.
Now is a good time to google the Vuforia Astronaut Image. You can either print it out in colour or do what I did and search it on my mobile phone. Press Play and hopefully you get the same result.
How awesome is that! Imagine waves of zombies coming at you and you need to shoot them down.
If you found this article helpful, please give me a Clap, as this brightens my day knowing I may have helped someone in their journey in making stuff! Also if you want to be notified for future releases in this series, “Follow” me. You may also send me a message if you need any further help.