We’re always looking for ways to improve the experience of developing with the Leap Motion Controller, so I’m excited to share a new tool in the toolbox for Unity3D developers. The Unity3D Boilerplate is a lightweight set of scripts and prefabs meant to get your new or existing Unity3D project Leap Motion-enabled as quickly as possible. It’s based on our own experiences developing with Unity3D, feedback from developers working on applications, and a variety of game jams and hack events. Take a look at our quick tutorial video, or keep reading for more details:

Getting your projects off the ground

Available now for free in the Unity3D Asset Store, the Boilerplate Asset helps with three challenges we run into daily in working with the Leap Motion Controller. The first is having a reliable, centralized point from which to poll the Leap Motion frame data. Keeping this in the same place in all our projects and examples means that when we share new code, we can be sure it will drop projects with the minimum of fuss.

The Boilerplate Asset also provides convenient hooks to manage type and unit conversions between Leap Motion Vector units and Unity3D world space Vector3s. The Boilerplate extends our Vector type with unit conversion methods that all return Unity3D Vector3s – converted for a variety of situations including positions, velocities, and direction vectors. The LeapManager prefab also provides hooks to handle screen space conversions for these values.

Convenience functions and new examples

Our final goal was to give developers a set of common convenience functions that we’ve found ourselves writing, day in and day out. Things like getting the positions of the front-most finger in the screen space, or determining whether or not a hand is open.

An example scene from the Unity3D Boilerplate Asset

The Asset itself has a well documented README, and the internal scripts backing the LeapManager prefab are well-commented. It’s architected so that everything sits in a LeapMotion folder, so it won’t muck up your project’s organization, and includes all the plugin files for the Leap Motion SDK for both Mac and Windows.

You’ll also discover a brand-new set of example scenes that demonstrate the use of most of the Boilerplate’s functionality. We’ll also be releasing tutorial videos to show how to setup your project and how to convert the asset to work with Unity3D Free. You can also check out our full documentation on the Developer Portal.

Now it’s your turn

I’ve been using the boilerplate in all my projects for the past few weeks, and it’s definitely sped up my setup and general development time. I hope that you’ll find that it makes getting started on 3D apps a lot easier too. Remember, if you don’t have a Unity Pro license, you can still access all of our resources in the free version – it just takes a few extra steps.

If you’re already using our existing Leap Motion Starter Kit asset, make sure to check out the latest update: v1.3. Not only have we renamed it to Leap Motion Demo Pack, but we’ve restructured the contents and made it much easier to get started. It’s a great place to get some pre-built examples, including driving, flying, and shooting scenes. Plus, if you’ve been thinking about the best method to incorporate a HUD or 2D menu system into your Leap Motion project, take a look at the Freeform and Marching Menu Assets.

I’d love to hear back from you. If you have any feedback, suggestions, or questions, please reach out to us on our forum Unity thread or post in the comments below.

Note: The Unity Boilerplate has been deprecated. Be sure to download our Unity Core Assets (or Core Assets: VR Edition) from developer.leapmotion.com/downloads/unity.