# 9. Apply Motion Tracking

## TL;DR

Which motion do you want to control with motion adapters? Refer to the below table.

| If you want to control...           | with data set of...           | Recommended Motion Adapters                                                                                                                                                                                                          |
| ----------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Bone 1D Controller                  | Eye blink                     | <p><a href="9.-apply-motion-tracking/bone-motion-adapters/eyeblink-and-eyeblinkall">👉 (Bone) EyeBlink</a><br><a href="9.-apply-motion-tracking/bone-motion-adapters/eyeblink-and-eyeblinkall">👉 (Bone) EyeBlinkAll</a></p>         |
| Bone 1D Controller                  | Head tilting / Chest position | [👉 BoneTiltOrPosition](https://myty.gitbook.io/products/kit/make-animation/9.-apply-motion-tracking/bone-motion-adapters/bonetiltorposition)                                                                                        |
| Bone 2D Controller                  | Face direction                | [👉 Bone2D](https://myty.gitbook.io/products/kit/make-animation/9.-apply-motion-tracking/bone-motion-adapters/bone2d)                                                                                                                |
| Sprite 1D Range Controller          | Eye blink                     | <p><a href="9.-apply-motion-tracking/sprite-motion-adapters/eyeblink-and-eyeblinkall">👉 (Sprite) EyeBlink<br></a><a href="9.-apply-motion-tracking/sprite-motion-adapters/eyeblink-and-eyeblinkall">👉 (Sprite) EyeBlinkAll</a></p> |
| Sprite 2D Nearest Controller        | Mouth size                    | [👉 (Sprite) Mouth](https://myty.gitbook.io/products/kit/make-animation/9.-apply-motion-tracking/sprite-motion-adapters/mouthsprite)                                                                                                 |
| Rigged Sprite 2D Nearest Controller | Mouth size                    | [👉 (Sprite) Mouth](https://myty.gitbook.io/products/kit/make-animation/9.-apply-motion-tracking/sprite-motion-adapters/mouthsprite)                                                                                                 |

## What is the Motion Adapter?

* The Motion Adapter takes motion capture data from MotionTemplate, processes it, and feeds it to the Controllers.
* There are different Motion Adapters for different types of data processing. Data processing type in turn depends on the type of motion data and the type of Controller(s) that will be used.
* Theoretically, if there are M number of motion data types that can be tracked and N number of Controllers, a total of M\*N number of Motion Adapters can exist.
* MYTY Kit v1.0 provides 14 types of Motion Adapters prefabs to handle the more common animation scenarios.
* There are two categories of motion adapters: **Mapper** and **Reducer**.

{% hint style="info" %}
Do you wanna get more advanced information? Check this page.\
👉 \[[advanced-documentation](https://myty.gitbook.io/products/kit/make-animation/9.-apply-motion-tracking/advanced-documentation "mention")]\(9.-apply-motion-tracking/advanced-documentation)
{% endhint %}

## Basic knowledge of Character movement

This section contains guides showing you how 2D characters move along the 3D motion.

{% content-ref url="9.-apply-motion-tracking/character-movement" %}
[character-movement](https://myty.gitbook.io/products/kit/make-animation/9.-apply-motion-tracking/character-movement)
{% endcontent-ref %}

## Types of Motion Adapters in MYTY Kit

MYTY Kit gives you everything you need to create a stunning live avatar. To apply motion tracking to your NFT avatar in real-time, take a closer look at these motion adapters.

{% hint style="info" %}
With the release of MYTY Kit v1.0, **Motion Adapters have been fully updated.** The previous version of MYTY Kit Motion Adapter is located in the <mark style="color:purple;">`Assets > MYTY Kit > MotionAdater > Deprecated folder`</mark>. For more information on how to use it, please refer to this page. 👉 [v0.1.0-9.-apply-motion-tracking](https://myty.gitbook.io/products/kit/misc/legacy-documentation/v0.1.0-9.-apply-motion-tracking "mention")&#x20;
{% endhint %}

### Bone Motion Adapters

Bone Motion Adapters connect the motion data coming from the motion template to the Bone Controller. There are **5 types of Bone Motion Adapters** in MYTY Kit, and each adapter can import motion data set as below.

<table><thead><tr><th width="242">Motion Adapter Name</th><th>Configured Motion data</th></tr></thead><tbody><tr><td><strong>Bone2D</strong></td><td>Chest, Head joint</td></tr><tr><td><strong>BoneTiltOrPosition</strong></td><td>Chest, Head joint</td></tr><tr><td><strong>EyeBlink &#x26; EyeBlinkAll</strong></td><td>Simple Face Parameters (size of left/right eye)</td></tr><tr><td><strong>EyeBrow &#x26; EyeBrowAll</strong></td><td>Simple Face Parameters (height of left/right eyebrow)</td></tr><tr><td><strong>Pupil &#x26; PupilAll</strong></td><td>Simple Face Parameters (position of left/right pupil)</td></tr></tbody></table>

#### How to use Bone Motion Adapters?

{% content-ref url="9.-apply-motion-tracking/bone-motion-adapters" %}
[bone-motion-adapters](https://myty.gitbook.io/products/kit/make-animation/9.-apply-motion-tracking/bone-motion-adapters)
{% endcontent-ref %}

### Sprite Motion Adapters

Sprite Motion Adapters connect the motion data coming from the Motion Template to the Sprite Controller. There are **3 types of Sprite Motion Adapters** in MYTY Kit, and each adapter can import motion data set as below.

<table><thead><tr><th width="242">Motion Adapter Name</th><th>Configured Motion data</th></tr></thead><tbody><tr><td><strong>EyeBlink &#x26; EyeBlinkAll</strong></td><td>Simple Face Parameters (size of left/right eye)</td></tr><tr><td><strong>EyeBrow &#x26; EyeBrowAll</strong></td><td>Simple Face Parameters (height of left/right eyebrow)</td></tr><tr><td><strong>Mouth</strong></td><td>Simple Face Parameters (wide and height of mouth)</td></tr></tbody></table>

#### How to use Sprite Motion Adapters?

{% content-ref url="9.-apply-motion-tracking/sprite-motion-adapters" %}
[sprite-motion-adapters](https://myty.gitbook.io/products/kit/make-animation/9.-apply-motion-tracking/sprite-motion-adapters)
{% endcontent-ref %}

## How to apply Motion Adapters

### 1. Add DefaultMotionTemplate

1\) In the Project window, Select <mark style="color:purple;">`Assets > MYTYKit > MotionTemplate`</mark>. Drag DefaultMotionTemplate to a blank area in the Hierarchy window.

### 2. Add MediapipeMotionPack

1\) In the Project window, Select <mark style="color:purple;">`Assets > MYTYKit > MotionTemplate > Motion Source Samples`</mark>. Drag <mark style="color:purple;">`MediapipeMotionPack`</mark> to a blank area in the Hierarchy window.

2\) Click the <mark style="color:purple;">`MediapipeMotionPack > MediapipeMotionSource`</mark> in the Hierarchy window. Then, in the Inspector window, click the <mark style="color:purple;">`✚ icon`</mark> below the Motion Template Mapper List.

3\) Set the <mark style="color:purple;">`Element 0`</mark> to the <mark style="color:purple;">`DefaultMotionTemplate`</mark> GameObject.

### 3. Create Motion Adapter Group

1\) Right-click on a blank area of the Hierarchy window, and select <mark style="color:purple;">`Create Component`</mark> to create a GameObject for the <mark style="color:purple;">`MotionAdapter Group`</mark>.

2\) In the Inspector window, click <mark style="color:purple;">`Add Component`</mark> and apply the <mark style="color:purple;">`Motion Adapter Group Script`</mark>.

### 4. Add Motion Adapters

1\) In the <mark style="color:purple;">`Project window`</mark>, go to <mark style="color:purple;">`Assets > MYTYKit > MotionAdapter`</mark>, click and drag the prefabs you want to apply into the <mark style="color:purple;">`MotionAdapter Group`</mark> object in the <mark style="color:purple;">`Hierarchy window`</mark>.

2\) In the <mark style="color:purple;">`Inspector window`</mark>, adjust the settings for each MotionAdapter, selecting the appropriate scripts, Controllers, and objects.

3\) If nothing appears when you click the ◉ icon, it may be due to either of the following:

1. The DefaultMotionTemplate or the MediapipeMotionPack is not in the Hierarchy window → Check [#add-defaultmotiontemplate](#add-defaultmotiontemplate "mention") and [#add-mediapipemotionpack](#add-mediapipemotionpack "mention")
2. The appropriate Script(s) are not applied to the Controller → Check [#2.-create-controller](https://myty.gitbook.io/products/kit/8.-myty-kit-controllers#2.-create-controller "mention")

4\) Click <mark style="color:purple;">`▶️(Play)`</mark> to check that Motion Tracking works as intended.

{% hint style="warning" %}
Repeat steps 1 to 4 for each bone or sprite animation.
{% endhint %}

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