By: Dan Nesfeder
We loved this awesome example of a bike route captured with the Strava app and visualized using the Maps Unity SDK and Apple’s ARKit. The question was could we recreate it on Android?
Pablo and I took a deep dive into Google’s Tango SDK for Unity and the Maps Unity SDK to see if we could pull it off. Here’s what we were able to throw together on a Friday:
Want to build something similar or tweak the code? We’ve made the project repo public on Github. Check out the README to get started.
Building the demo
We first followed this example and learned how Tango can detect surfaces in an environment and places objects on them, like cats for instance. The example demonstrated how we can handle user taps on the screen, and then, create a virtual cat based on real-world geometry. We were able to register the cat in the right 3D position in the room utilizing the depth camera built into the Phab 2.
Our final goal was to have a Mapbox map centered in a room that we could walk around and look at through the Android phone. We followed this mesh generation tutorial to create the map. What was a cat in the first example was now a Unity GameObject displaying a section of the Mapbox map, which we were able to observe with the phone. If you want to add extrusions of 3D buildings, then follow this tutorial.
Since neither of us had prior experience with Unity or the development environment, we found most of our issues arose from trying to figure out how to move objects and how those objects would move in reference to the TangoCamera. Unity has some quick tutorials addressing the exact problem we had — positioning the camera in reference to a GameObject.
Interested in mobile AR? Explore our Maps Unity SDK. Share what you build with us on Twitter and tag #BuiltWithMapbox.
AR on Android with Tango + Unity + Cats was originally published in Points of interest on Medium, where people are continuing the conversation by highlighting and responding to this story.