Journal 136 — Unity App Development, AR using Vuforia
Objective: To start building an app using Vuforia
In this new series, I will put together an educational app that uses a 3D model of a horse and its anatomy to show in augmented reality (AR) using Vuforia.
To start, we need to add the Vuforia assets from Unity. You can also add the Vuforia Core Samples which has several assets that we can use to experiment with.
After adding, you need to register for a free developer account and BASIC subscription, which allows for free development, with some limitations.
Once registered, you need a BASIC license to use in Unity. After you name and create your license, you can select it and it will show you a license key that you can copy and paste into Unity.
Back in Unity, we need a new 3D scene, and import the Vuforia assets. You should have something like this.
Now in the Hierarchy, you can remove the Main Camera, and create a new Vuforia Engine AR Camera and a Vuforia Engine Image Target.
Essentially after building the app, the Image Target will serve as the trigger when using your phone or tablet camera to activate specific game objects and specific behavior that you develop.
On the Image Target game object, drag one of the VuforiaMars_Images onto the Image Target Behaviour component. You will also need to print the selected image to paper, so you can use a phone or webcam in a test build.
As you see the message in the Inspector, you need to add the license key. In the “VuforiaConfiguration” file under Resources folder, you need to copy and paste the App License Key.
To test Vuforia, I will add a couple 3D objects to near the Image Target in the Scene View.
Then, I will switch the platform to Android, and hook up my Pixel 6 Pro via USB cable and select Build and Run.
Now to start with actual model files, I will attach a 3D model of a horse to the Image Target and try another test build. The horse model includes some animation views of muscles and bones that we will trigger through code.
We’ll start to set up a basic UI with a couple buttons to control some animations of the horse.
Then we need to double click on the horse Animator to bring up the Animator window and we want to do a couple things: Right-click and create an Empty state that is default and drag in the two animations that show the horse fade to its interior muscle, and the fade from the interior muscle to its bones.
The last update for this article is to rearrange the animations to trigger from Any State condition. Create two animation triggers to transition from the outer view of the horse to interior muscle, and from interior to muscle to its bone, and apply them to transitions.
Thank you for your time!
In the next article, I will prepare C# scripts to control the animation.