HoloLens with Xamarin UrhoSharp

HoloLens is a Mixed Reality headset, that combines a real world view, with virtual objects. When developing for HoloLens, most will use Unity3D with the HoloLens SDK. Unity is a commercial product, and not free for commercial use. However, another option is to use UrhoSharp, a Xamarin lead port, of the open source software Urho, to .NET.

Setup

Even if you don’t have a spare pile of cash lying around, to purchase a headset, there is a HoloLens emulator, that can easily get you started. If you need the emulator, check out Install The Tools, to install it and ensure you download all prerequisites.

After this, you can create your first HoloLens UrhoSharp project, by using the default template provided. Search online templates for HoloLens, and create a new project.

Select the HoloLens Emulator, and run the application.

After this, you will see the HoloLens emulator start, and you will see the Moon orbiting the Earth.

Device Portal

Before we delve into code, it’s worth noting of the Device Portal. Press the Open Device Portal button on the emulator.

You will now be presented with the portal, that has much useful information, and functions, such as logging.

The differences for a HoloLens application, is the inheritance from SteroApplication.

public class HelloWorldApplication : StereoApplication

As with any UrhoSharp app, you have a Scene, you need to create children on. Once this child is created you can add textures and actions. Please see my other UrhoSharp articles for more information on this.

// Create a node for the Earth
earthNode = Scene.CreateChild();

Also, HoloLens accepts gesture input, and there are events you can override. To simulate hand gestures within the HoloLens Emulator, please take a look at Using the HoloLens emulator.

HoloLens of course does a lot more than just presenting virtual objects in your view. It will also accept Speech input, Hand Gesture Recognition, and can communicate with web based services. An example would be using Azure’s Cognitive Services to provide facial recognition.

Learn More

This was a very basic look at getting started with HoloLens with UrhoSharp. Please look at the HoloLens UrhoSharp Samples, that include a dancing Mutant, Crowd Navigation and interacting with Cognitive Services, to start delving deeper.

XAMARIN WEEKLY NEWSLETTER

Subscribe to a hand-picked round up of the best Xamarin development links every week. Published every Friday. Free.