This article is about running a Lumin and displaying a Cube in a real world environment.

Step 1: Prepare before development

  • Magic Leap One glasses complete developer Settings.

  • Open and unlock your device.

  • Turn on your controller.

  • Make sure the equipment is ready for development.

  • Install any version of Microsoft Visual Studio 2017 (Windows) or Microsoft Visual Studio Code (Windows/macOS).

  • Package Manager installs the Lumin Runtime Editor and the SDK for the Lumin Runtime.

  • Create a developer certificate.

If you are not familiar with the above process, please refer to the article: juejin.cn/post/684490…


Install and configure the Magic Leap Visual Studio 2017 extension for Windows.

This extension adds Magic Leap features to Visual Studio 2017.

Install and configure the Magic Leap Visual Studio 2017 extension.

  • In Package Manager, under Common Packages, install Visual Studio 2017 Extension.

  • Click Launch Installer in the window on the right. The diagram below:

2. Add developer certificates to Visual Studio.

  • Click Tools > Options.

  • Expand Magic Leap-sdks from the list and then add the path to the Magic Leap developer Certificate in the Package Signing Certificate File. The diagram below:


Install and configure the Magic Leap Visual Studio code extension for Windows/macOS.

1. Use Magic Leap Package Manager to download the Common Packages > Visual Studio Code Extension Package.

2. Start Visual Studio Code.

3. Click the Extensions icon on the left.

4. Click on the… Icon, click Install from VSIX, and select the Visual Studio code extension. The VSIX file. Normally, path is/Users/user/MagicLeap/tools/visual_studio_code/vx x.x. / mlextension – X.X.X.V six, the following figure:

5. Reload Visual Studio Code.

6. Click the icon on the left​ 。

In 7.Lumin SDKIn the window title, clickIcon, and then set the Lumin SDK path. The usual path is,/Users/user/MagicLeap/mlsdk/v0.x.x.

In 8.Signing CertificateIn the window title, clickIcon, and then set.certPath to the package signing certificate file.


Create a new Lumin Runtime Editor project

We open the Lumin Runtime editor to create our scene (this will automatically generate the code in the background to load the scene into Visual Studio or Visual Studio code project).

1. In Package Manager, scroll down to the Lumin Runtime Editor and click the Launch button in the right window. The diagram below:

2. In the Lumin Runtime click New Project.

3. Fill in the relevant information of the project, as shown in the figure below:

4. Click Create Project. Click OK when a dialog box pops up to create the project. The diagram below:

5. Enter our project scene smoothly.


Step 5: Set your External Editor

Before making changes to your project, make sure that the Lumin Runtime editor uses Either Visual Studio or Visual Studio Code to edit the Code.

1. In the File menu, click Editor Preferences.

2. In the Editor Preferences dialog, click Src Editor (Ext).

3. If Editor and Path are empty, select your Editor and add the Path to the Editor. Such as:

  • For Visual Studio (Windows):

  • Visual Studio Code (Windows/macOS)

4. Click Apply and Close.


Step 6:Add in assets

1. In Asset Library, right-click Model and select Import File. The diagram below:

2. In the SourceArt\Model\Primitives folder, select the cube_p. FBX file. You may need to navigate to Magic Leap\ MLSDK \

\lumin\runtime\editor\template\pipeline\SourceArt.

3. Then click OK.

The Cube will be generated with the following effect:

Create your Scene


Now we need to add the Cube to the scene.

1. In the scene hierarchy, right-click root. Then insert a model. Go to Insert > Core > Model. The diagram below:

2. Click the “Model” folder and select the newly generated cube_p. FBX. The diagram below:

3. Set some parameters of Cube (the following data is for reference) :

  • Id: cube

  • Shader: UnlitTextured

  • Opaque: selected

  • Transform Position: to 0.0, -0.25, -0.75.

  • Transform Scale: to 0.5, 0.5, 0.5

4. Save the scene.

Step 8: Build the application in Visual Studio (Windows)

1. From the Project menu of the Lumin Runtime Editor, click Code Generation > Open Code in External Editor. Then open your project with Visual Studio.

2. When prompted, click Yes to create the Visual Studio project.

3. Build the application program as an. MPK file and deploy it on the device.

  • Plug your device into the computer.

  • Select the Debug – ML.

4. Run the APP, and the effect is as follows:

Build an X64 application and debug it on Magic Leap Remote. (For those unfamiliar with Magic Leap Remote, see The Magic Leap Development Guide (1) — Preparation.)

  • Start the Remote program.

  • Select the Debug – ML.

  • Click Local Windows Debugger to run the application.

Build the application in Visual Studio code (Windows/macOS)

1. From the Project menu of the Lumin Runtime Editor, click Code Generation > Open Code in External Editor. Then open your project with Visual Studio.

2. When this window appears, click OK:

3. Open your project in Visual Studio Code. Generate an. MPK file and debug it on the device.

  • Plug your device into the computer.

  • Click the icon on the left.

  • Set the Debug target to Lumin OS Debug.

  • Click on the triangle icon to start debugging.

4. Build and debug an x86 application on Magic Leap Remote:

  • Start Magic Leap Remote.

  • Click the icon on the left.

  • Set the Debug target to Host OS Debug.

  • Click on the triangle icon to start debugging.

The overall process is similar to step 8.

Tips:

1. If it is the first time to deploy an application program on the device, a certificate installation notification is displayed. Accept the certificate to install the application.

2. If you don’t see anything, try turning your head to look at your surroundings.

3. Note: The direction the device faces when it starts determines its initial orientation in the world.


——AR Portal (AR developer community)

Follow wechat public account (AR developer exchange community, provide AR development dry goods, promote THE development of AR content) : AR developer community