# 8. MYTY Kit Controllers

## What is a Controller?

MYTY Kit comes with a <mark style="color:purple;">`Bone Controller`</mark> , <mark style="color:purple;">`Sprite Controller`</mark> and <mark style="color:purple;">`Rigged Sprite Controller`</mark>. The Bone Controller transforms the Avatar’s Bones for **bone animation.** The Sprite Controller selects Avatar’s Sprites for **frame animation**. Lastly, The Rigged Sprite Controller combines the Bone Controller and the Sprite Controller so that it can control the **bone-rigged sprites**.&#x20;

Each Controller except the Rigged Sprite Controller is divided further, based on the number and function of the input variables from the motion tracking data.

* Bone Controller is divided into <mark style="color:purple;">`Bone 1D Controller`</mark>, and <mark style="color:purple;">`Bone 2D Controller`</mark>.
* Sprite Controller is divided into <mark style="color:purple;">`Sprite 1D Range Controller`</mark> and <mark style="color:purple;">`Sprite 2D Nearest Controller`</mark>.

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2F1UCnIeYHIwD9WLZUFEA5%2FControllers.png?alt=media&#x26;token=5208a256-802d-4a1f-860b-3f693062fcd1" alt=""><figcaption><p>The five types of Controllers in MYTY Kit. </p></figcaption></figure>

* **Bone Controller**
  * Bone 1D Controller
  * Bone 2D Controller
* **Sprite Controller**
  * Sprite 1D Range Controller
  * Sprite 2D Nearest Controller
* **Rigged Sprite 2D Nearest Controller**

## Key Summary of Controllers

|            | Bone 1D Controller                         | Bone 2D Controller                          | Sprite 1D Range Controller                               | Sprite 2D Nearest Controller                             | Rigged Sprite 2D Nearest Controller                    |
| ---------- | ------------------------------------------ | ------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------ |
| **Input**  | The float value of 1 MotionAdapter Output. | The float values of 2 MotionAdapter Output. | The float value of 1 MotionAdapter Output.               | The float values of 2 MotionAdapter Output.              | The float values of 2 MotionAdapter Output.            |
| **Output** | Transformation of **connected bone**(s).   | Transform Control of **connected bone**.    | Selection of appropriate **sprite image(s)** to display. | Selection of appropriate **sprite image(s)** to display. | Transform Control of **sprite mesh rigged with bone**. |

{% hint style="info" %}
For the relationship between the Controller and MotionAdapter, please refer to [6.-before-rigging](https://myty.gitbook.io/myty-kit/make-animation/6.-before-rigging "mention")
{% endhint %}

## Bone Controller

The Bone Controller transforms bones rigged to an Avatar. Bones have three transform states: Position, Rotation, and Scale. Controllers use external inputs to change the three transform states and make the Avatar move.

#### The following are defined in the Bone Controller.

* A list of bones to manipulate. (At least 1)
* conTransform state when input variable(s) is(are) at min/max

### Bone 1D Controller

This Controller manipulates Bones using 1 float value as an input variable.

* **You can use the Bone 1D Controller to make animations like these!**
  1. When the user moves their eyebrows up and down, the Avatar’s eyebrows also move up and down.
  2. When the user blinks, the Avatar’s eyelids also move up and down.

[→ How to use the Bone 1D Controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/bone-1d-controller)

#### Bone 1D Controller tool reference

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FZ2RqlnQg3zG3Zo5HheGf%2FImage%20-%201-%20Controller.png?alt=media&#x26;token=aac4d268-66e9-4aa1-91dc-e74537a1f662" alt=""><figcaption></figcaption></figure>

1. <mark style="color:purple;">`Controller`</mark>: Select the Controller you’d like to customize.
2. <mark style="color:purple;">`Add`</mark>: Add Bones you’d like to connect to the Controller.
3. <mark style="color:purple;">`Remove`</mark>: “Disconnect” selected Bone(s) from the Controller.
4. <mark style="color:purple;">`RemoveAll`</mark>: “Disconnect” all Bones from the Controller.
5. <mark style="color:purple;">`Bone List`</mark>: Display the list of Bones connected to the Controller.
6. <mark style="color:purple;">`Control Slider`</mark>: This Slider is activated once the Input Variable’s Min and Max values and their respective Transform States have been set. You can change the Control Value to preview the Avatar’s movement.
7. <mark style="color:purple;">`Min`</mark>: Set the minimum value of the Bone’s range of motion.
8. <mark style="color:purple;">`Max`</mark>: Set the maximum value of the Bone’s range of motion.

***

### Bone 2D Controller

This Controller manipulates Bones using 2 float values as input variables.

<details>

<summary>You can use the Bone 2D Controller to make animations like these!</summary>

* When the user’s face moves up, down, left or right, the Avatar’s face mirrors the movement.

![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FLup1hLgOIQSczAi5LKCi%2FFaceController.gif?alt=media\&token=aca2123f-374a-413e-83b8-54080df603bc)

* When the user’s body moves left, right, front, and back, the Avatar’s body mirrors the movement.

![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2F7Fznxo32jIfML8VPkhnz%2FBodyController.gif?alt=media\&token=ef5df490-ed80-4082-9a33-85a9ea982912)

</details>

[→ How to use the Bone 2D Controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/bone-2d-controller)

#### Bone 2D Controller tool reference

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2F4Vn9tLXX6zLvasV04mxV%2FImage%20-%202-%20Controller.png?alt=media&#x26;token=51df422f-2060-4bde-905f-23f3a8a90eeb" alt=""><figcaption></figcaption></figure>

1. <mark style="color:purple;">`Controller`</mark>: Select the Controller you’d like to customize.
2. <mark style="color:purple;">`Recursive Selection`</mark>: Check this checkbox to include child(ren) bone(s) when adding a bone object. Unchecking this checkbox will only add the selected bone object.
3. <mark style="color:purple;">`Add GameObjects`</mark>: Add Bones you’d like to connect to the Controller.
4. <mark style="color:purple;">`Remove`</mark>: “Disconnect” selected Bone(s) from the Controller.
5. <mark style="color:purple;">`RemoveAll`</mark>: “Disconnect” all Bones from the Controller.
6. <mark style="color:purple;">`Bone List`</mark>: Display the list of Bones connected to the Controller.
7. <mark style="color:purple;">`Control Panel`</mark>: This Panel is activated once transform states of Bones have been added using the Pivots Buttons (9). You can move the panel’s pointer to preview the Avatar’s movements in the XY axes.
8. <mark style="color:purple;">`Position, XY Scale factor`</mark>: Position indicates the position of the Control Panel's pointer. By adjusting the scale factor, you can expand or contract the Control Panel.
9. <mark style="color:purple;">`Reset Position`</mark>: This button resets all Bone states to the Origin values.
10. <mark style="color:purple;">`Origin, Left, Right, Up, Down`</mark>: Set the transform values of all bones in the bone list for the Origin(al) position and the Left, Right, Up, and Down directions.

## Sprite Controller

### Sprite 1D Range Controller

This Controller manipulates Sprites based on the range of a single float’s value.

<details>

<summary><strong>You can use the Sprite 1D Controller to make animations like these!</strong></summary>

* When the user closes their eyes, the open-eye Sprite changes to the closed-eye Sprite.

![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FPHwZ1Sx4XFIaSVhlDA2d%2Fsprite1D.gif?alt=media\&token=3a8daee6-050b-4672-8508-38a29bee3c29)

</details>

[→ How to use the Sprite 1D Controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/sprite-1d-range-controller)

#### Sprite 1D Range Controller tool reference

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FGIHNPXGV0TKxSfGF7x78%2FImage%20-%203-%20Controller.png?alt=media&#x26;token=a5e08e10-66e3-423f-b044-b4f42715dbd6" alt=""><figcaption></figcaption></figure>

1. <mark style="color:purple;">`Controller`</mark>: Select the Controller you’d like to customize.
2. <mark style="color:purple;">`Add`</mark>: Add Sprite Object(s) you’d like to connect to the Controller.
3. <mark style="color:purple;">`Remove`</mark>: “Disconnect” selected Sprite Object(s) from the Controller.
4. <mark style="color:purple;">`RemoveAll`</mark>: “Disconnect” all Sprite Object(s) from the Controller.
5. <mark style="color:purple;">`GameObejcts List`</mark>: This displays a list of all sprite objects connected to the current Controller.
6. <mark style="color:purple;">`Min,Max`</mark>: Set the minimum and maximum values of the motion data being fed as input to the current Controller.
7. <mark style="color:purple;">`Value`</mark>: Modulate the motion data value being fed as input to the current Controller. This slider can be used to preview the sprite animation for a given input value.
8. <mark style="color:purple;">`Current Label`</mark>: This displays the sprite label for the avatar currently shown in the scene.
9. <mark style="color:purple;">`Auto Load Labels`</mark>: Automatically load sprite label(s) from the Sprite library.
10. <mark style="color:purple;">`Sprites list`</mark>: This is a list of sprites for frame animation automatically loaded from imported assets. You can set the data value in which each sprite will appear.

### Sprite 2D Nearest Controller

This Controller takes two float values and displays the Sprites with the closest coordinate designation.

<details>

<summary><strong>You can use the Sprite 2D Controller to make animations like these!</strong></summary>

* When the user moves their mouth, the Avatar’s mouth Sprite changes accordingly.

![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FFyEaM7Gt99l4vEJR5DZO%2FMouthController.gif?alt=media\&token=a2d8001e-ae16-41b6-948f-b1b61b7bc4ca)

</details>

[→ How to use the Sprite 2D Controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/sprite-2d-nearest-controller)

#### Sprite 2D Nearest Controller tool reference

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FGxRp0rNUIA515WjbSvVZ%2FImage%20-%204-%20Controller.png?alt=media&#x26;token=31b91f73-8754-4f7e-accd-c84762207093" alt=""><figcaption></figcaption></figure>

1. <mark style="color:purple;">`Controller`</mark>: Select the Controller you’d like to customize.
2. <mark style="color:purple;">`Add`</mark>: Add Sprite Object(s) you’d like to connect to the Controller.
3. <mark style="color:purple;">`Remove`</mark>: “Disconnect” selected Sprite Object(s) from the Controller.
4. <mark style="color:purple;">`RemoveAll`</mark>: “Disconnect” all Sprite Object(s) from the Controller.
5. <mark style="color:purple;">`GameObjects List`</mark>: This displays a list of all sprite objects connected to the current Controller.
6. <mark style="color:purple;">`Control Panel`</mark>: This panel is activated once one or more sprite labels for an input variable value have been set. You can move the panel’s pointer to preview the avatar’s sprite animation for two input values.
7. <mark style="color:purple;">`Current Value, Bottom Left, Top Right`</mark>: \
   **Current Value:** Controls the motion data value that is fed as input to the current Controller. Moving the pointer in the Control Panel will change XY values. \
   **Bottom Left & Top Right:** You can set a particular motion input value for the Bottom Left and Top Right positions.
8. <mark style="color:purple;">`Pivot name, Pivot Position`</mark>: \
   **Pivot name**: The state of the deformed sprite mesh is saved with its name. \
   **Pivot Position**: The state of the deformed sprite mesh is saved in the corresponding value position.
9. <mark style="color:purple;">`Copy Position`</mark>: Copies the position value of the current pointer.
10. <mark style="color:purple;">`Make New Pivot`</mark>: A button that creates a pivot with a pivot name and pivot position.
11. <mark style="color:purple;">`Auto Load Labels`</mark>: Automatically load sprite label(s) from the Sprite library.
12. <mark style="color:purple;">`Sprite Pivots list`</mark>: This is a list of sprites for frame animation automatically loaded from imported assets. By double-clicking each pivot, You can set the data value in which each sprite will appear.

## Rigged Sprite 2D Nearest Controller

This Controller takes two float values and displays the bone-rigged sprites with the closest coordinate designation.

<details>

<summary><strong>You can use the Rigged Sprite 2D Nearest Controller to make animations like these!</strong></summary>

* Transform the lip sprite mesh by moving the rigged bone.

<img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FOvIZjQXnx64bvpgbsQVV%2Frigged%20sprite%202D.gif?alt=media&#x26;token=adbcc9cb-8ed0-484c-8b34-46371a68a809" alt="" data-size="original">

</details>

[-> How to use the Rigged Sprite 2D Nearest Controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/rigged-sprite-2d-nearest-controller)

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FGhg17FzMKeZJ5Dg7phAd%2FImage%20-%205-%20Controller.png?alt=media&#x26;token=1d2fbfde-ba8b-499c-834e-75e6ec0092df" alt=""><figcaption></figcaption></figure>

1. <mark style="color:purple;">`Controller`</mark>: Select the Controller you’d like to customize.
2. <mark style="color:purple;">`Recursive Selection`</mark>: Check this checkbox to include child(ren) bone(s) when adding a bone object. Unchecking this checkbox will only add the selected bone object.
3. <mark style="color:purple;">`Add`</mark>: Add Bones you’d like to connect to the Controller.
4. <mark style="color:purple;">`Remove`</mark>: “Disconnect” selected Bone(s) from the Controller.
5. <mark style="color:purple;">`RemoveAll`</mark>: “Disconnect” all Bones from the Controller.
6. <mark style="color:purple;">`Bone List`</mark>: Display the list of Bones connected to the Controller.
7. <mark style="color:purple;">`Anchor`</mark><mark style="color:purple;">:</mark> This button sets the sprite mesh based on the transform information of the selected bones. Click to switch the window to editor mode.&#x20;
8. <mark style="color:purple;">`Control Panel`</mark>: This Panel is activated once transform states of Bones have been added using the Pivots Buttons (9). You can move the panel’s pointer to preview the Avatar’s movements in the XY axes.
9. <mark style="color:purple;">`Value, Bottom Left, Top Right`</mark>: \
   **Value:** Controls the motion data value that is fed as input to the current Controller. Moving the pointer in the Control Panel will change XY values. \
   **Bottom Left & Top Right:** You can set a particular motion input value for the Bottom Left and Top Right positions.
10. <mark style="color:purple;">`Pivot name, Pivot Position`</mark>: \
    **Pivot name**: The state of the deformed sprite mesh is saved with its name. \
    **Pivot Position**: The state of the deformed sprite mesh is saved in the corresponding value position.
11. <mark style="color:purple;">`Copy Position`</mark>: Copies the position value of the current pointer.
12. <mark style="color:purple;">`Make New Pivot`</mark>: A button that creates a pivot with a pivot name and pivot position.
13. <mark style="color:purple;">`Pivots list`</mark>: Created Pivots list.

## How to use Controllers

{% hint style="success" %}
**📌 Please ensure that you follow the following steps in order!**
{% endhint %}

### 1. Create a ControllerGroup

Before you create a Controller, create a parent object of all Controllers and name it the ControllerGroup.

1. Right click on the Hierarchy window and select <mark style="color:purple;">`Create Empty`</mark>.
2. Rename <mark style="color:purple;">`GameObject`</mark>to <mark style="color:purple;">`ControllerGroup`</mark>.

![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2Fm5xhLRWIdQQeYJBP5TC0%2FController_1.gif?alt=media\&token=5ef78d0e-ba46-40c6-bc5f-4b08e7056841)

3\. In the Inspector panel, click on <mark style="color:purple;">`Add Component`</mark>, and select the <mark style="color:purple;">**`Root`**</mark> <mark style="color:purple;">**`Controller(script)`**</mark>and <mark style="color:purple;">**`Controller Group(Script)`**</mark>components.

![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2F7xeMqh9qWyMvJg9ITfvS%2FController_2.gif?alt=media\&token=b43b001e-8795-4ab4-a602-d159bd8ed4e6)

### 2. Create Controller

All Controllers follow this step.

1\. Right click on <mark style="color:purple;">`ControllerGroup`</mark> and select <mark style="color:purple;">`Create Empty`</mark> to create a new <mark style="color:purple;">`Controller Object`</mark>

{% hint style="warning" %}
While you’re free to name Objects as you wish, **it is recommended that you include the name of the applicable Skeleton(Bone group) in the Object’s name.**
{% endhint %}

2\. In the Inspector panel, click <mark style="color:purple;">`Add Component`</mark> and select the <mark style="color:purple;">`Controller Script(s)`</mark> you want to apply.

* Applicable Controller Scripts
  * Bone 1D Controller -> **Bone 1D Controller(Script)**
  * Bone 2D Controller -> **Bone 2D Controller(Script)**
  * Sprite 1D Range Controller -> **Sprite 1D Range Controller MSR(Script)**
  * Sprite 2D Nearest Controller -> **Sprite 2D Nearest Controller MSR(Script)**
  * Rigged Sprite 2D Nearest Controller -> **Rigged Sprite 2D Nearest Controller(Script)**

![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FPxYFHwwxgC00L4Wwm6nR%2FBone1D_1.gif?alt=media\&token=a3848186-01ba-4de3-a5e7-c68e352e9a0a)

3\. Navigate to <mark style="color:purple;">`Header Toolbar > MYTY Kit`</mark>and select the Controller that you'd like to use. This will open up the Controller window. You can drag its tab to the Inspector window to use it there.

![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FAngnqiiWiyd41Y3mOwBP%2FBone1D_2.gif?alt=media\&token=044796ac-d361-4139-9b4b-7fc1db170baa)

### 3. Further steps unique to each Controller

{% content-ref url="8.-myty-kit-controllers/bone-1d-controller" %}
[bone-1d-controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/bone-1d-controller)
{% endcontent-ref %}

{% content-ref url="8.-myty-kit-controllers/bone-2d-controller" %}
[bone-2d-controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/bone-2d-controller)
{% endcontent-ref %}

{% content-ref url="8.-myty-kit-controllers/sprite-1d-range-controller" %}
[sprite-1d-range-controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/sprite-1d-range-controller)
{% endcontent-ref %}

{% content-ref url="8.-myty-kit-controllers/sprite-2d-nearest-controller" %}
[sprite-2d-nearest-controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/sprite-2d-nearest-controller)
{% endcontent-ref %}

{% content-ref url="8.-myty-kit-controllers/rigged-sprite-2d-nearest-controller" %}
[rigged-sprite-2d-nearest-controller](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/rigged-sprite-2d-nearest-controller)
{% endcontent-ref %}

## Controller Hierarchy

![Example - The Controller hierarchy for GhostsProject avatars](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2F0Zl6IkAef8tbus7F8OKz%2Fcontroller%20hierarchy.png?alt=media\&token=2bbe4e98-0b34-49ba-9300-b02028ee051e)

#### Root Controller & Controller Group

* This is the uppermost controller, and has the <mark style="color:purple;">`Root Controller(Script)`</mark> and <mark style="color:purple;">`Controller`</mark> <mark style="color:purple;">`Group(Script)`</mark> components.

#### Sprite 1D/2D Controller

* Each Sprite Controller is a child element of the Root Controller, and **exists independently**.

#### Bone 1D/2D Controller & Rigged Sprite 2D Nearest Controller

* Bone Controllers and Rigged Sprite 2D Nearest Controller exist under the Root Controller. You can set Parent-Child relationships to reflect the hierarchy of desired animations and Rigged Bones. **Bone Controllers at the same level must manipulate different Bones.**

{% hint style="success" %}
**Have a question or an idea?** \
If you have a question to ask or an idea to share, participate in the [MYTY Kit Community](https://discord.com/invite/myty). We’d love to hear from you.:smile:
{% endhint %}
