Getting started in Augmented Reality is easier than you think. There’s a number of AR Software Development Kits available on the market that integrate with commonly used developer tools such as Unity. This tutorial will walk you through the basics of setting up project in Unity that will allow you to anchor an animated 3D model to something as simple as video game case. But before we get started… You are going to need / do the following:
Below an example of what you can achieve by following this tutorial
1. Create a new project in Unity and name it “Alien Demo”. Make sure you have the 3D option checked. Now click “Create Project”. 2. In your project under the “Hierarchy” panel, make sure you delete the “Main Camera” 3. You should already have a Vuforia account, so you will need to login, then go to the downloads section and download the latest version of the SDK for Unity. Now drag and drop the Vuforia SDK into your “Assets” folder. When you are prompted, make sure you click the “Import” button. 4.You should still be logged into Vuforia, now you will need to click on Develop > Target Manager > Add Database. Make sure you have the type “Device” selected and then click "Create". 5. Open up your freshly created database in Vuforia then click on add Target and upload your pre-scanned image. Make sure you select the type “Single Image” and set a default “Width” of 5. Now clik the “Add” button. See the example below: 6. Download your target database for Unity Editor by clicking the "Download Database (All)" button Note: Generally, the higher the star rating the better. The rating is an indicator of how many mapping / anchor points were located in your image. This makes it easier for Vuforia to identify and graph things such as textures or models. 7. Drag and drop your Unity package into your “Assets” folder and click “import”. Once you’ve done this you will then need to locate the Vuforia “PreFabs” folder and drag the “AR camera” object to the root of your “Hierarchy”. You are also going to need to drag in the “Image Target” object too. 8. Click on your “Image Target” in your Unity project and select the database “Alien Demo” then set the object property Image Target” to the name of the pre-scanned image you provided earlier. See below: 9. Look for your image target texture in the Assets > Editor> Vuforia> ImageTargetTextures>AlienDemo and manually set the Texture Shape to 2D and click apply. 10. In your Hierarchy panel, your “AR Camera” object should already be moved to the root of the tree. Now then place “Image Target” inside “AR Camera”. See the example below: 11. Let’s put a textured surface slightly above the “Image Target”, by adding a 3D “Plane” (right click on the hierarchy panel > 3D Object > Plane) inside the “Image Target”. You will also need to resize the plane to that of the “Image Target”. Once you’ve done that then find a random texture on google and apply it to the plane. You will also need to make sure you position the plane slightly above the “Image Target” in your scene editor. See the example below: 12. Now it’s time to import and anchor your alien model to your pre-scanned surface. Open your browser and paste the following URL: https://www.assetstore.unity3d.com/en/#!/content/20838. Then click the “Open in Unity” button and then click the “Import” button. When prompted, import all the “Assets”. See below : NOTE: You will need a Unity account for this to work properly 13. Look for the “Alien Character” folder under your assets and then locate the prefab, “Alien Character”. Drag this to your scene and place in the middle of the plane. Make sure your “Alien Character” sits inside the “Image Target” in your hierarchy” See below: 14. Let’s increase the scale of your model by 0.3 on the X,Y & Z axis to make the model slightly larger. See below: 15. Login back into the Vuforia developer’s portal and add a new licence key. Select a developers licence as shown below: 16. Now open your newly created licence and copy the licence key. This step will then require you to go back to your Unity project and select “AR Camera” from your object hierarchy and then set the “World Centre Mode” property to “DEVICE_TRACKING”. Now click on the “Open Vuforia Configuration” button and set the following properties: NOTE: Yes, this means you will need to paste your licence key and select a camera attached to your computer too. 17. Save your project and hit the play button!. Hold up the picture you pre-scanned in step 5. You should now see the Alien instantly graphed before your eyes. Woot! You’re done. Easy, wasn’t it? I encourage you to explore and play around with things like virtual buttons. AR is poised to be the next multibillion dollar industry that will have immense impact in the medical, scientific, business and social arena. So I strongly encourage anybody with an interest in this technology to experiment with it and push the boundaries. Thanks for following this tutorial and if you have any questions or get stuck please reach out.