Welcome to the week 2 tutorial of our Augmented Reality tutorial series. In the previous tutorial of this series, we learned about
• Adding 2D object into a real world
• Hovering Images over the real world target
• Playing Videos on the real world target
Last week, we have published a week 1 Augmented Reality Tutorial Series, if you haven't seen that yet, go check it out. At the end of the tutorial, we asked users to make their own AR app by following our tutorial and share the video link of the same with us. And we will then feature the best on career-high.
So this week's "AR Enthusiast" is Rajat Kumar Gupta who has successfully followed the tutorial and created his own AR-based Newspaper in just 2-3 hours. Check the awesome YouTube video!
Here is the source code by Rajat: GitHub Repo
If you also want to be featured on CareerHigh, Share your AR app video with us on social media. Tag your post/ tweet with #CareerHigh #AugmentedReality on LinkedIn, Facebook, and Twitter and we will feature a best on CareerHigh.
In this section of the 4-week tutorial, our primary focus will be on doing animations in Augmented Reality using 3D models. You'll need to get familiar with the assets store in Unity and you will be downloading 3D models from the assets store - with inbuilt animations.
So Let's start.
• First, Create a new project in Unity.
• Add “AR camera” and ‘Image Target” into the project. And delete “Main Camera”
• So after adding “AR camera” and your ‘Image Target”, your Unity will look something like this.
• Open “Asset Store”, which is located near “Game” window. If you do not have this there, then go to “Window” > “Asset Store”
The “Unity Asset Store” is home to a growing library of free and commercial assets created both by Unity Technologies and members of the community. A wide variety of assets is available, covering everything from textures, models, and animations to entire project examples, tutorials and editor extensions.
• To download any asset from this store, you will need to create a Unity account. Once you have created your own account, just log into your Unity account.
• Now, use the search bar to search for a model and search for “3D Character”. There will be numerous models available for your project.
• You can use any model of your choice but make sure your model has animation. If you don't want to spend money on assets, select "FREE ONLY" for free Assets. In this tutorial, we will be using Pxltiger’s zombie model. It has 3 animations to it, walk, attack and fallback.
• Click on “Download” button to download it
• Click on “import” to import it into the project.
• After importing, you can see the package in your “Assets” hierarchy at the bottom left corner.
• When you open the “Animation” folder of this “zombie” package, you can see animations of this model.
• Now, select the model on which you want to work on (in this tutorial, we are gonna use “walk” animation of zombie), go to the “Inspector” window, change the Animation type from Generic to legacy since the Animation clip is read-only ".FBX" file. Therefore, we need to make it legacy to make it work in our project.
“Animation type” parameter defines the type of animation present in the model. You can select from following four options.
None - when no animation present in a model
Legacy - It is for using Legacy Animation System, Actually it is for importing and using the animation of the old version.
Generic - It is for using Generic Animation System. You can use this if your rig is non-humanoid (quadruped or any entity to be animated).
Humanoid - It is for using Humanoid Animation System. You can use this if your rig is humanoid (it has two legs, two arms, and a head). Unity usually detects the skeleton and maps it to the Avatar correctly.
• Finally, drag the 3D model on to your Image Target.
• When pressing play, you should be able to have your custom image tracked and see the model appear above it.
• Finally, Build the project to run it on your phone. If you do not know how to do that then go to week 1 of this tutorial series.
Now you have a 3D model capable of doing animations in augmented reality.
If you are interested in learning how to make your own custom animation then let us know in below in comments section.
Every week, we will challenge you to build engaging AR experiences by making use of what you have learned in the tutorial.
So this week‘s task is
Make a 3D Model Animation Application
• Implement a basic app that displays an animation of any 3d model. Combine everything you learned last week and this week, and make a great creative AR experience.
Hopefully, this was helpful and don’t hesitate to let us know if any of those steps don’t work anymore or if anything seems confusing! Post your doubts in the comments section.