# Sprite 2D Nearest Controller

{% hint style="danger" %}
There is no hierarchy priority for Sprite Controller.
{% endhint %}

{% hint style="info" %}
For instructions on how to create a Sprite 2D Nearest Controller, please refer [here](https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/..#2.-create-controller).
{% endhint %}

1\. Open the Controller window by clicking the <mark style="color:purple;">`upper toolbar > MYTY Kit > Sprite 2D Nearest Controller`</mark><mark style="color:purple;">. I</mark>f you drag and drop a tab into the Inspector window, you can use it together within the Inspector window.

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FOwFeGODPDl19XdUeS4Zx%2Fsprite2D_1.gif?alt=media&#x26;token=15296223-aa13-4331-b1e1-fbffe4514f2f" alt=""><figcaption></figcaption></figure>

2\. After clicking the ◉ icon on the right side of the Controller input window, designate the Controller object you want to control on the Sprite 2D Controller panel.

![Object selection example- The object to which the Sprite 2D Controller Component is applied is displayed.](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FWDioEWz3WfirxIxc5hnW%2FScreen%20Shot%202022-07-07%20at%203.18.10%20AM.png?alt=media\&token=2bcd62fe-2841-4f59-9823-7b3c29cec8d7)

3\. Find the <mark style="color:purple;">`Sprite object`</mark> you want to control in the Hierarchy panel and select multiple objects.

![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FiujauLCZiV8Fn8HqZB8f%2FScreen%20Shot%202022-07-07%20at%203.19.50%20AM.png?alt=media\&token=b2d04e48-af99-4d99-ae08-566bab994c2b)

4\. Click the <mark style="color:purple;">`Add`</mark> button in the Controller Inspector window to add the relevant bone to the list of bones to be controlled.

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2Fh4DOjErHQPAZczB8KvVO%2Fsprite2D_2.gif?alt=media&#x26;token=556c96e7-936c-4542-bfd6-9a2d476f9072" alt=""><figcaption></figcaption></figure>

5\. Select <mark style="color:purple;">`Auto Load Labels`</mark> to automatically load Sprite Labels to frame animation.

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2F2ivQfZo6QowvUwXvYvQi%2Fsprite2D_3.gif?alt=media&#x26;token=cecdcf6f-376a-4d19-84fb-714956b31be5" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
f the following error appears when multiple Sprite objects have been added, it means that the sub-layer names of the Sprite objects in the Animation Group of the PSB file are not the same as each other.\
![](https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FbEHAw5ucRWQDkPz84wDf%2FScreen%20Shot%202022-06-27%20at%204.04.06%20PM.png?alt=media\&token=d62c61fb-99b1-4529-8d93-6560ba828b99)
{% endhint %}

6\. Double-click each label and set the range in which the sprite with each label will be expressed. You can set the expression range of the Sprite by specifying the Min and Max values to match the input value.

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2FJJavbVQbZj1egWmYQpg5%2Fsprite2D_4.gif?alt=media&#x26;token=8eb496e8-e567-4e80-b643-6f84cdb4136e" alt=""><figcaption></figcaption></figure>

7\. By moving the pointer on the value panel, you can preview the frame animation according to the input value.

<figure><img src="https://667382355-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZT6KDsWarcdCAiEJZ3TV%2Fuploads%2F2yl0KFFnQt75c9kJArS4%2Fsprite2D_5.gif?alt=media&#x26;token=52a1fe99-2930-4e86-8e6f-87a210ce1baf" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://myty.gitbook.io/myty-kit/make-animation/8.-myty-kit-controllers/sprite-2d-nearest-controller.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
