Although Tango is not optimized for VR, motion tracking enables you to experiment with 6-DOF experiences. In this guide, we'll show you how to combine the Tango SDK for motion tracking with the Google Cardboard SDK to handle lens distortion with the Durovis Dive 7.
- Tango SDK for Unity.
- Cardboard SDK for Unity.
- An existing Unity project. This tutorial assumes the project doesn't have Tango or Cardboard integrated yet.
Setting up the viewer
Before running your application, you'll need to configure the Cardboard viewer. Install the Cardboard app if necessary, launch the app, then select Switch viewer under the overflow menu. When prompted to scan the viewer profile, use the following QR code.
This will configure Cardboard apps to correctly display for a 7" tablet using the Durovis Dive 7 viewer.
Combining Tango with Cardboard
- Open your project in Unity.
- Remove the default camera by deleting it from the Heirarchy panel.
- Import both the Tango SDK and Cardboard SDK packages.
- Delete the folder Plugins/Android/google-unity-wrapper. Some classes conflict and are redundant with the Cardboard SDK.
- We need to edit the AndroidManifest.xml file, located in the Projects
panel at Assets/Plugins/Android/AndroidManifest.xml. Open it, locate the
line with the
uses-sdktag, and change the
17. The full line should be
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="22" />after your edits.
- From the Assets/TangoPrefabs folder, drag the Tango Manager prefab into the Hierarchy panel.
- From the Assets/Cardboard/Prefabs folder, drag the CardboardHead prefab into the Hierarchy panel.
- In the Hierarchy panel, select the CardboardHead prefab.
- Uncheck the Track Rotation and Track Position options of the Cardboard Head script. We'll be using the rotation and position provided by Tango instead.
- Add a Character Controller and the Tango Delta Pose Controller script to the CardboardHead prefab by using the Add Component button.
- Check the Character Motion option of the Tango Delta Pose Controller script you just added.
- If necessary, go to Build Settings and change the platform to Android. Next click Player Settings.... Under Resolution and Presentation change the Default Orientation to Landscape Left. Under Other Settings provide a Bundle Identifier and change the Minimum API Level to Android 4.2 'Jelly Bean' (APK level 17) or higher.
- Build and run your application.
This screenshot shows what you should see, using a simple scene with two cubes.
If the program looks different (e.g. the rendered area doesn't fill the screen) you may have the wrong viewer configured. Follow the instructions on setting up the viewer to fix this.