Magic Leap With Unity3d tutorial:
In this tutorial, We are going to setup the Lumin SDK to create an app using magic leap. We will create an app in which character is dancing.
The first thing you need to do is to update the unity because only unity 2018.1 technical preview supports magic leap. You need to download magic leap from here, you can see the “Download Installer” button in the latest release tab. Installation is very simple, just click on next button and it will install the magic leap simulator on your pc.
Download the magic leap module:
The second thing you need to do is go to creator.magicleap.com/downloads/lumin-sdk/unity and download the magic leap module. This link will ask you for your email. Just put your email id and click confirm it will send you a verification code to your email id. Just copy that code and past it in password side on the website.
It gives you an option to switch your platform from default pc to Lumin SDK. After installing the package it will give an option to download the latest Lumin SDK for unity 3d. It will show you a new window and ask you for sign in same as the website. Just enter your id and it will send you a verification code to your email. Copy that code and paste it into code area and click on continue. It will redirect you to the Lumin dashboard in default Lumin package manager.
The environment of Lumin Package Manager
If you have already installed the Lumin SDK it will show you tick in common packages section. It will also give you an option to download and install Lumin SDK on the right-hand side if you don’t have it yet.
You can also download the Magic Leap Unity Package but it is not required in this lesson.
If you are not sure about the unity version that magic leap support you can click on “open in browser” it will redirect you on the download page of unity website.
Create Room For Magic Leap simulator
When its all done, just search the magic leap remote and click on it, it will start a magic leap simulator window and we will load a virtual room the for the magic leap. You can see a Magic Leap Remote opens a new window just click on start simulator on the right-hand side of the screen to start a virtual simulator.
When it is load it may ask some permission don’t worry about that just click on allow button if it asks. When simulator starts you may have this issue you don’t have any virtual room because you haven’t created one that why it shows the magic leap icon that you can move around.
Create a Virtual Room:
To create a virtual room goto users\youruser you will see the magic leap folder. If you see more than one magic leap folder it means you have created the virtual room before. For, now just goto MagicLeap/MoSDK/v0.xx.x/VirtualDeive/bin and there you have a virtual room generator click on it. It will show a new window that allows you to create a virtual room.
For this lesson we are not changing anything in the room, you can generate new room click on “Generate Room Button” you can zoom in and zoom out from your mouse scroll. Click on Export button, it will give you an option to choose location and name for this lesson put name “MagicLeapDemo”.
Close the virtual room generator window and open the magic leap simulator, it still shows the demo icon so you need to load the virtual room just click the on the menu on upper right corner and click on load virtual room, select “MagicLeapDemo” room that we just create and then it will show a room.
Create Project for Magic Leap Simulator:
Run Unity 2018 create a new project by clicking on the new button. Type “MagicLeapDanceDemo” in name and switch template to Magic Leap. The only difference in 3d and Magic Leap is it automatically set up the camera according to magic leap environment. When project is loaded you can see the default platform is default pc to switch it to Lumin SDK just go to file and build settings and select the Lumin SDK, you can see the three dot button it allows you to put the Lumin SDK location it is mandatory you must have to set the location for it for this lesson location is “[Location]”, us click on switch.
Setup the character:
Lets set up the character for the Lumin platform. we are using the Mixamo character here is the link you can download it. Just import the character. After that, Click on fbx file and go to material tab in the inspector panel and click on extract textures. It will extract textures from fbx model, go to the model tab and change scale to 0.5 and hit apply. Drag character into the scene in front of the camera. It must be visible in the game panel so it will dance in front camera. Next thing is to attach the dancing animation in this character, right click in the project panel and create animator controller and name it “ChracterAnimatorController”. Drag this animator controller to character animator component and open the animator controller.
Renaming the character:
After that, Select the model under the animation tab in inspector panel to rename animation to “dance”. Check loop time and loop pose so it allows the animation of animator controller to play in a loop. Hit Play you can see the character dancing in the unity editor. Let’s play this dancing animation in magic leap simulator. Now, we need to set up the camera according to magic leap environment. Just go to magic leap in unity file menu and select enable zero iteration. It will ask you to restart Unity3D and it is mandatory. It may ask you to save the scene if you don’t save it yet. After the restart, you can see it imports a new folder in the project that supports this project to play in a simulator.
Just click on play. After clicking on the play button in unity it will open the open the magic leap simulator screen. You can see in the simulator is mowing character is dancing same as in unity editor. If you rotate your head in the simulator, unity camera is also rotating as well. It means that you have perfectly configured the magic leap simulator with unity 3d.
You can also watch this video as a reference.
In this Magic Leap With Unity3d tutorial, We have set up the Lumin SDK to create an app using magic leap in unity 3d. We have also created an app that will show a character dancing in a virtual room that we created using VirtualRoomGenerator
You can get more knowledge bits from here.