Thoughts on what one needs to learn for Magic Leap development.
Having just learned Unity and then Magic Leap development through two courses (both are excellent in different ways):
- Udemy course Learn Unity 3D for Absolute Beginners (No-Cost)
- Pluralsight course Unity Fundamentals (Paid)
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:
- High Level API Components for Runtime NavMesh Building (No Cost): This packages, supplied by Unity, enables runtime navigation mesh building
- Animal Pack Deluxe (Paid): A package available in the Unity Asset Store with high quality animated animals; the chicken is used specifically in this example
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:
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.
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.
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.
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.
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.
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.
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.
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.
Hope you found this helpful.