My First shot at AR. Take the app, point it at a currency note (500rs), and see Sonic walk all over it. You can also move it around, change the size of the character etc...
-
Download Unity (https://unity3d.com/).
-
Login/ Register in https://developer.vuforia.com/
-
Once inside https://developer.vuforia.com/ go to Develop tab and add a License Key.
a. Project Type: Development b. Provide App Name and click Next. Agree terms and conditions. c. Click on the app name to get your license key. Copy and keep it safely.
-
Go to "Target Manager" tab and Add a database. Name it anything you want and select Type as Device and Create your database.
-
Download 500Rs.png from the repository.
-
Click on your database and Add Target. Browse for file and select the 500Rs.png image. Width: 5 and give it any Name.
-
Click on Download Database and select Unity Editor.
-
Select the "Downloads" tab and click "Download for Unity".
-
Download "test.fbx" from the repository.
-
Open Unity and create a new project.
-
Go to File -> Build Settings. In the platforms menu select Android and download android module. Then select it and close the Build Settings.
-
Drag and drop the "vuforia-unity-6-2-10.unitypackage" that you downloaded, into "Assets" folder in the editor and click "Import".
-
Drag and drop the database that you downloaded, into "Assets" folder in the editor and click "Import".
-
Drag and drop the "text.fbx" also into the assets folder.
-
Click on File -> Save Scene As. Save it as main.
-
Inside Assets/Vuforia/Prefabs. Drag and drop ARCamera and Image Target under main (in the top left of the unity editor) and delete the main camera under the main if it is there.
-
Select the ARCamera and under the Inspector tab click "VuforiaConfiguration".
-
Add License Key that you copied from step 3. Click and Database and Load and Activate your database.
-
Select the image target gameobject from the scene and choose your image target database from the dropdown, and choose the image target you want to track.
-
Drag and drop the test.fbx inside image target gameobject. Now you should be able to see Sonic standing on the note. Adjust the scale in Transforms. My Transform parameters are as follows.
-
Now you can try it out. Go ahead and click the "Play" button on top and put a 500 Rupee note in front of your webcam.
-
Download Standard assets (https://www.assetstore.unity3d.com/en/#!/content/21064) and import it into assets.
-
The navigate to Assets/Standard Assets/CrossPlatformInput/Prefabs/ and drag and drop the MobileSingleStickControl under main and delete jump button.
-
Click on mobilejoystick and adjust the size. Restrict Movement range to 50 inside Joystick.
-
Click on test and click Add component under Inspector tab. Add rigidbody and uncheck Use gravity.
-
Add new script called SonicController. Copy the contents of SonicController.cs from the repo to the script.
-
Click on text.fbx from assets and under Inspector tab select Rig and select Animation type to be Legacy.
-
Click on ARCamera under main. Under the Inspector tab click Add component. Add script Focus Camera and copy the contents of focusCamera.cs into the file.
-
You can test it out by clicking the play button and check using the web cam.
-
Click File-> Build Settings and click on Add Open Scenes and add main.
-
Click Build and Run. Choose ADB and choose where to save the apk. Plug in your android device and the app will run on the device.
Here you go Vishal Gauba, Atish Majumdar ...