Why Did the Chicken…

John Tucker
Aug 27, 2018 · 5 min read

Thoughts on what one needs to learn for Magic Leap development.

I sometimes get asked by my web developer peers what does it take to build a Magic Leap application. As C# has a lot in common with modern JavaScript, I recommend that folks begin by learning Unity (and C#).

note: However tempting, avoid UnityScript, an older deprecated language based on JavaScript.

Having just learned Unity and then Magic Leap development through two courses (both are excellent in different ways):

I found a mix of content that is relevant and not to Magic Leap development. Through example, we explore this relevance.

The example involves an animated chicken (virtual) that is able to navigate around obstacles (real) on a table (real) to a dropped food pellet (virtual). The blue shaker (virtual) can be moved around the table based on the position of the user’s head. Pellets are dropped using the ok hand gesture (right hand).

The final solution is available for download; but requires several third-party packages to run (see below).

Unity Game Development Pipeline
Unity Project Management

One requires fundamental Unity skills. This amounts to getting familiar with the core Unity concepts and getting around the development environment.

For Magic Leap development, the ability to import packages is required from the start. They require importing the Magic Leap Unity Package; supplied through the Magic Leap PackageManager software.

This example additionally uses the following packages:

Unity Scene Building

While one requires the basics of scene building (materials, colliders, rigid bodies, and prefabs), there are fundamental differences when developing a Magic Leap application. In particular the complexities of terrains in not terribly relevant.

Less is More
Adding too many elements to a scene can detract from the power and presence of virtual content in the real world. Fewer objects and simpler geometries can feel more real, more solid, more miraculous. It also avoids straining the hardware and works more easily within the FOV.
As a simple demonstration, try rendering a large, busy scene into the room, then compare it with a simple white cube.

Magic Leap — Art & Animation

This example only includes four visible game objects:

Lighting

The complexities of lighting is not relevant to Magic Leap development.

Because virtual content will be displayed in the real world in a variety of lighting conditions, keep your lighting scheme relatively generic.

— Magic Leap — Art & Animation

This example uses a single Directional Light game object supplied in the Magic Leap template.

Particles

Particle systems are relevant to Magic Leap applications.

Take advantage of particle systems. Adding small, camera facing planes can be very effective as long as they’re small and further away.
Mesh Particles can create great volumetric effects, establish a scene as having depth.

— Magic Leap — Art & Animation

The configuration of particle systems, however, are strangely complicated. In this example, we used the default settings with minor adjustments.

Navigation

As Unity, as of 2017, supports High Level API Components for Runtime NavMesh Building, navigation is relevant to Magic Leap development. As indicated earlier, this navigation solution requires downloading a (no-cost) package. It is also particularly well documented in an official Unity tutorial.

In this example, we use Magic Leap’s Meshing feature, described in Introduction to Meshing — Unity Edition, to build a mesh out of the physical world. We then use Unity’s NavMesh feature to identify the walkable regions (blue highlight) of it.

In particular, the NavMeshSurface has a method, BuildNavMesh, to build (aka bake) the navigation mesh at runtime as used in MeshParent.cs script in this example.

Scripting

While both Unity tutorials do not cover scripting with any depth, it is necessary in Magic Leap development as most of the Magic Leap features are exposed as C# APIs.

This example uses two Magic Leap features, Hand Poses in the script KeyPoseHandler.cs, and Meshing in the script MLSpatialMapper2.cs.

Also, as one writes more complex applications one will want to explore a more robust state management strategy. I found the Unity EventManager pattern particularly simple and effective.

Animations

One will not get very far in Unity (or Magic Leap) development without using being able to use animation; even though it may not be necessary to create them yourself.

This example uses two animations, chicken_idle and chicken_walk, supplied in the Animal Pack Deluxe package. The simple implementation involves a Chicken controller with transitions conditioned on the parameter IsWalking.

The controller’s IsWalking parameter is managed by the Chicken.cs script.

Audio

In spatial computing, sound has an almost magical ability to ground virtual objects in reality, expand the user’s field of perception, and provide details to objects that would otherwise go undeveloped in traditional media.

Magic Leap — Audio

In this example, we just added some clucking sounds to the chicken.

UI

In the context of Unity, the UI feature primarily enables one to display content fixed to the screen. The challenge with Magic Leap development, however, there is no screen per se. The article Interacting with Head Locked Content Unity® Edition, provides an approach that provides similar functionality leveraging the Unity UI system.

This example displays the application’s mode in the lower-right of the screen using this approach; specifically detailed in another article: My First “Real” Magic Leap Project: Part 6.

Wrap Up

Hope you found this helpful.

Coinmonks

Coinmonks is a non-profit Crypto educational publication.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store