Augmented Reality with Unity and Vuforia Plugin

Augmented Reality is a technology that superimposes a computer-generated image on a user’s view of the real world, thus providing a composite view. The cross between the two worlds allows for manipulation of objects without any physical changes.

Unity is a cross-platform game engine developed by Unity Technologies,[2] which is primarily used to develop both 3 dimensional and 2 dimensional video games and simulations for computers, consoles, and mobile devices. Using a plugin known as Vuforia, it is also now possible to use it for augmented reality.

If you want to start creating augmented reality apps and games, you can download both Unity and Vuforia, which come pre built with a few samples.

In this article, I will show how to simulate a car on top of a marker, which I chose as a dollar bill.

You first need to go to developer.vuforia.com and create an account. There you click on the Develop tab and add a new license key. This will be used in a later step.

Screen Shot 2017-12-31 at 4.48.05 PM

Then you need to go to Google Images and find a picture of a dollar bill. Download this and then click Target Manager on the Vuforia site. Here you create a new dollarTarget database where you can upload the picture you downloaded.

Screen Shot 2017-12-31 at 4.48.19 PM

Once you create it, download the Unity Database package that it will generate. Also go to the Downloads section on the Vuforia page and download the Unity plugin for Vuforia.

Drag these both into a new Unity Project and import all the files. Then delete the Main Camera and drag in an AR Camera from Assets/Vuforia/Prefabs/ARCamera. Click on the ARCamera and then on the side panel you should see VuforiaConfiguration. Here you should paste the license key you obtained earlier. Under that, enable the dollarTarget database and click activate.

Under the AR Camera, you then need to drag in the ImageTarget from Assets/Vuforia/Prefabs/ImageTarget. This is the step where you can Google for 3D models of any object, it doesn’t need to be a car. Once you download it (.fbx or .obj formats are the best), you can drag it onto the ImageTarget.

IMG_20171222_135427

You can test it by clicking Play and holding up a dollar bill. If you want to run it on a phone, you need to click File->Build Settings and then change your platform.

This is very basic and can be extended with scripts and further manipulation of objects to create apps and games.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s