We're going to take two prefabricated scenes from the Google Tango SDK to create an app that renders a virtual reality environment in real-time. This was done using Unity 5.3.4 and the Tango 'Gemma' SDK.
Getting startedImport the Gemma SDK by navigating to assets > import package > import custom package in Unity. In the Project Navigator, open the Tango SDK folder, then Examples and then Scenes. There you will find pre-built scenes demonstrating the capabilities of Tango.
Go ahead and open Experimental Virtual Reality, then copy the Tango VR Player Object and paste it into the Experimental Mesh Builder Scene.
The cameras are composed of different scripted components that come together to serve a function. For example, in the Mesh Builder scene there is an observer camera that processes some of the room's features. A lot of this isn't clearly documented so we're flying rather blind, but what we will demonstrate is that it's easy to cobble together something even when working with complex pre-built features and scenes.
Now you have two cameras in the scene, so we'll need to merge the features of both while keeping those needed for VR and rendering the room.
It's important to move up the VR camera, keeping it close to the floor will throw off the perspective of the project which is dangerous for the user. Using the Y-axis arrow, pull the camera up to match where the Tango Delta Camera is (you'll see this to the right in the inspector panel).
Start moving the cameras over from the Delta Camera to the VR camera, you'll get a warning about breaking up the prefab which is fine.
And turn off any extra cameras by unchecking the camera feature. Don't delete any objects quite yet, a lot of this is necessary to make sure the mapping feature works!
Once all the features are transferred over, you can delete the Delta Camera and leave only the VR camera. The camera preview is a good indicator of what you'll see once the app is running and the environment is being rendered.
That's it! Now go to File > Build Settings, update the Bundle identifier with the right format (com.companyName.productName
) with something other than what's included, set the Minimum API Level to 17 and then build and run. The finished product will look like this:
This is an incredibly easy first project to working with Tango in Unity, now go poke around and break some stuff!
Comments