How to create your own controllers for Mixed Reality ToolKit ??

If you have tried the latest version of Mixed Reality Toolkit (MRTK) you might be asking yourself, how can you change the default Gizmos controllers? The original idea from MRTK is to obtain the default controllers with each of the SDK that we export to our projects, but due to the incompatibility at the time to deserialize with NewtonSoft in projects compilated in IL2CPP, this functionality is being delayed. In this version, if we export to UWP, we can see the controllers, but without any type of animation.


The good news is that we can replace those default gizmos for any other model we want, even better, create our own controllers from zero for our games.


Let’s begin with a base project from MRTK, you can download the latest version here.


Create a news scene and save it.



The next step is to set up our scene to work in Mixed Reality



Select the configuration by default and copy it so we can adapt it to our needs. First, we click on copy & paste, then we click on clone and save it.



Select the input tab and clone the general input profile. Finally, the display.



The configurable objects system is a little tricky in this version of MRTK, but the object is “break” the least possible inside the Toolkit and just modify what we need.

Let’s do it! We will create an empty GameObject and rename it to be our right controller.



Add the component “Mixed Reality Controller Visualizer” and change the ownership to the right controller.

We do the same for the controller in the left hand.



Functionally speaking the controllers are already created. Now, let’s add something visual, for this example I’ve downloaded a free asset from the Unity Store, that will allow us easily to distinguish the left hand from the right hand.



When we finish importing the asset, we drag the sword inside the GameObject. MyRightController and the shield inside of MyLeftController. If it’s for lefthanded people, just change the shield for the sword.



Since the sword pivot is centered and we want it to be in the sword handle, let’s displace it into the Y axis 0.6



We need prefabs, no GameObjects in the scene, so we will drag both into a folder, to generate the prefabs and be able to work in these.



Once created the prefabs, we can delete the GameObejects from the scene and assign them to our profile to replace the default controllers.



Now let’s do some adjustments to the prefabs of the controllers to be correctly seen, in size, position or rotation. If you have included the same sword and shield of my example, you can do the next adjusts if not you will have to do it by your own.

Let’s start by the shield, we double click to the prefab of MyLeftController and inside the prefab, we select GameObject of Shield_Desktop, the size I’ve changed it to 0.4 in all the axis and the rotation to 90 for the X axis.



Now let’s go with the sword, we double click on MyRightController and change the properties from GameObjectSword_Desktop: the size in the shield to 0.4 in all the axis, the rotation 180,90,90 and the position, I’ve changed it the one we put at the beginning to adjust it to the size in 0, 0, 0.2



Now let’s get into the fun part, try it!



Another examples pf controllers inside the project, in this case the 3D modeler has done it with the right coordinates, and it wasn’t necessary to change the size.



This a basic tutorial of how to create a simple personalized controller. We can create a more complicated one, capture the controller and associate it to animations or any effect we want from the 3D model to create our own controller functioning correctly in all the platform.


You can download the project here.


Written by: Marcos Rodriguez part of Idiwork’s team

Stay up to date!

Leave a comment