# RotateTo Action

This **Node** has different versions for [**Scenes**](https://docs.incari.com/incari-studio/objects-and-types/project-objects/scene) and [**Scene2Ds**](https://docs.incari.com/incari-studio/objects-and-types/project-objects/scene2d). Find in the tabs below the documentation for both versions.

{% tabs %}
{% tab title="Scene" %}
**Overview**

![The RotateTo Action Node.](https://1553081948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU990HLHWA30dTfELtDUK%2Fuploads%2Fgit-blob-a6105ebf31029310d56259267b0a25a75d3400a0%2Frotatetoactionnode20241.png?alt=media)

The **RotateTo Action Node** continuously rotates a [**Scene Object**](https://docs.incari.com/incari-studio/objects-and-types/scene-objects) to the *Euler angles* specified in `To` for a given period of time, thus creating an **Animation**.

Furthermore, visit the [**Actions Nodes**](https://docs.incari.com/incari-studio/toolbox/actions) page for a general introduction to these **Nodes**, and [**Rotation**](https://docs.incari.com/incari-studio/objects-and-types/attributes/common-attributes/transformation#rotation) for more detail about the `Rotation` **Attribute**.

[**Scope**](https://docs.incari.com/incari-studio/overview#scopes): **Scene**, **Function**, **Prefab**.

**Attributes**

![The RotateTo Action Node Attributes.](https://1553081948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU990HLHWA30dTfELtDUK%2Fuploads%2Fgit-blob-39e41b70ec95edf74508556f920e1e12931800b8%2Frotatetoactionatts20241.png?alt=media)

| Attribute        | Type          | Description                                                                                                                                                                                                                                                                                                                                     |
| ---------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `To`             | **Vector3**   | The *Euler angles* along the X, Y, and Z axes to rotate to, if none are received in the `To` **Input Socket**.                                                                                                                                                                                                                                  |
| `Duration (sec)` | **Float**     | The total time of the **Action**, if none is received in the `Duration` **Input Socket**.                                                                                                                                                                                                                                                       |
| `Interpolation`  | **Drop-down** | The `Interpolation` method to use for calculating the intermediate values of the *Euler Angles*. It can be [*Linear*](https://en.wikipedia.org/wiki/Linear_interpolation), [*Sine Ease In*](https://easings.net/#easeInSine), [*Sine Ease In Out*](https://easings.net/#easeInOutSine), or [*Sine Ease Out*](https://easings.net/#easeOutSine). |

**Inputs**

| Input         | Type           | Description                                                                                                                                                                                        |
| ------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Instance ID` | **InstanceID** | The assigned [**Instance ID**](https://docs.incari.com/incari-studio/toolbox/actions/..#instance-id) of the **Action**. If nothing is received, it automatically assigns 0 as the **Instance ID**. |
| (►) `Start`   | **Pulse**      | A standard **Input Pulse**, to trigger the execution of the **Node**.                                                                                                                              |
| `Object ID`   | **ObjectID**   | The ID of the target **Object**.                                                                                                                                                                   |
| `Duration`    | **Float**      | The total time (in seconds).                                                                                                                                                                       |
| `To`          | **Vector3**    | The *Euler angles* along the X, Y, and Z axes to rotate to.                                                                                                                                        |

**Outputs**

| Output        | Type           | Description                                                                                                             |
| ------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `Instance ID` | **InstanceID** | The assigned [**Instance ID**](https://docs.incari.com/incari-studio/toolbox/actions/..#instance-id) of the **Action**. |
| `OnStart` (►) | **Pulse**      | Flows to the next **Node** following **RotateTo Action** when the **Action** starts.                                    |
| `OnEnd` (►)   | **Pulse**      | Flows to the next **Node** following **RotateTo Action** when the **Action** stops.                                     |
| {% endtab %}  |                |                                                                                                                         |

{% tab title="Scene2D" %}
**Overview**

![The RotateTo Action Node.](https://1553081948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU990HLHWA30dTfELtDUK%2Fuploads%2Fgit-blob-d48c95d2434ee02d9e6cb2092148eb6122210aed%2Frotatetoaction2dnode20241.png?alt=media)

The **RotateTo Action Node** continuously rotates a [**Scene2D Object**](https://docs.incari.com/incari-studio/objects-and-types/scene2d-objects) to the value specified in `To` for a given period of time, thus creating an **Animation**.

Furthermore, visit the [**Actions Nodes**](https://docs.incari.com/incari-studio/toolbox/actions) page for a general introduction to these **Nodes**, and [**Rotation**](https://docs.incari.com/incari-studio/objects-and-types/attributes/common-attributes/transformation#rotation) for more detail about the `Rotation` **Attribute**.

[**Scope**](https://docs.incari.com/incari-studio/overview#scopes): **Scene**, **Function**, **Prefab**.

**Attributes**

![The RotateTo Action Node Attributes.](https://1553081948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU990HLHWA30dTfELtDUK%2Fuploads%2Fgit-blob-6dd01b9ecec6a0a231c0b52203f08cfacf819fed%2Frotatetoaction2datts20241.png?alt=media)

| Attribute        | Type          | Description                                                                                                                                                                                                                                                                                                                                     |
| ---------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `To`             | **Float**     | The value to rotate to, if none are received in the `To` **Input Socket**.                                                                                                                                                                                                                                                                      |
| `Duration (sec)` | **Float**     | The total time of the **Action**, if none is received in the `Duration` **Input Socket**.                                                                                                                                                                                                                                                       |
| `Interpolation`  | **Drop-down** | The `Interpolation` method to use for calculating the intermediate values of the *Euler Angles*. It can be [*Linear*](https://en.wikipedia.org/wiki/Linear_interpolation), [*Sine Ease In*](https://easings.net/#easeInSine), [*Sine Ease In Out*](https://easings.net/#easeInOutSine), or [*Sine Ease Out*](https://easings.net/#easeOutSine). |

**Inputs**

| Input         | Type           | Description                                                                                                                                                                                        |
| ------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Instance ID` | **InstanceID** | The assigned [**Instance ID**](https://docs.incari.com/incari-studio/toolbox/actions/..#instance-id) of the **Action**. If nothing is received, it automatically assigns 0 as the **Instance ID**. |
| (►) `Start`   | **Pulse**      | A standard **Input Pulse**, to trigger the execution of the **Node**.                                                                                                                              |
| `Object ID`   | **ObjectID**   | The ID of the target **Object**.                                                                                                                                                                   |
| `Duration`    | **Float**      | The total time (in seconds).                                                                                                                                                                       |
| `To`          | **Float**      | The value to rotate to.                                                                                                                                                                            |

**Outputs**

| Output        | Type           | Description                                                                                                             |
| ------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `Instance ID` | **InstanceID** | The assigned [**Instance ID**](https://docs.incari.com/incari-studio/toolbox/actions/..#instance-id) of the **Action**. |
| `OnStart` (►) | **Pulse**      | Flows to the next **Node** following **RotateTo Action** when the **Action** starts.                                    |
| `OnEnd` (►)   | **Pulse**      | Flows to the next **Node** following **RotateTo Action** when the **Action** stops.                                     |
| {% endtab %}  |                |                                                                                                                         |
| {% endtabs %} |                |                                                                                                                         |

## Example

This section shows a simple example of how to use the **RotateTo Action** **Node** and the effect it has on a **Scene Object**. This concept can be applied as well to a **Scene2D Object**.

We start by [configuring the **Scene**](#scene-configuration), then [build the **Logic**](#logic), and finally show the [result](#final-result).

### Scene Configuration

We consider a [**Scene**](https://docs.incari.com/incari-studio/objects-and-types/project-objects/scene) with two [**Objects**](https://docs.incari.com/incari-studio/objects-and-types/scene-objects): a red [**Torus**](https://docs.incari.com/incari-studio/objects-and-types/scene-objects/primitives#torus) and a [**Directional Light**](https://docs.incari.com/incari-studio/objects-and-types/scene-objects/lights), both of which can be easily created in the [**Scene Outliner**](https://docs.incari.com/incari-studio/modules/scene-outliner). Then, we set the `Scale` **Attribute** of the **Torus** to $$(2, 2, 2)$$ and the `Position` of the **Light** to $$(0, 200, 0)$$. See this configuration in the following image:

![Scene configuration.](https://1553081948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU990HLHWA30dTfELtDUK%2Fuploads%2Fgit-blob-a0cb42d00ddf3e893a3bc8bd33698c46b01ca1de%2FExampleRotateTo_1.png?alt=media)

### Logic

We then need to configure the **Logic**. This is done in the [**Logic Editor**](https://docs.incari.com/incari-studio/modules/logic-editor).

We will use two **RotateTo Action** **Nodes** in order to first perform a *rotation* and then reverse it. For the first one, we set the following **Attributes**:

* `To`: $$(90, 90, 0)$$
* `Duration (sec)`: $$2$$
* `Interpolation`: `Linear`

And for the second **Node**:

* `To`: $$(0, 0, 0)$$
* `Duration (sec)`: $$2$$
* `Interpolation`: `Linear`

Then, we connect to both **Nodes** the [**Object Node**](https://docs.incari.com/incari-studio/objects-and-types/scene-objects#objects-in-the-logic) of the red **Torus**, a **Pulse** to the `Start` **Input Socket** of the first **RotateTo Action** and the **Output** `OnEnd` to the `Start` **Input** of the second **RotateTo Action** **Node**. Thus, having the following **Logic** configuration:

![Logic configuration.](https://1553081948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU990HLHWA30dTfELtDUK%2Fuploads%2Fgit-blob-0a3053c206321aaed7a6b1618812f35a84afe708%2FExampleRotateTo_2.png?alt=media)

### Final result

Finally, the effect of the **RotateTo Action** **Node** when triggered is the following:

![Final result.](https://1553081948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU990HLHWA30dTfELtDUK%2Fuploads%2Fgit-blob-673a2b801e71d28df7607407ff37549b4c4e1712%2FExampleRotateTo_3.gif?alt=media)

## See Also

* [**RotateBy Action**](https://docs.incari.com/incari-studio/toolbox/actions/rotatebyaction)
* [**RotateFromTo Action**](https://docs.incari.com/incari-studio/toolbox/actions/rotatefromtoaction)

## External Links

* [*Rotation*](https://en.wikipedia.org/wiki/Rotation) on Wikipedia
* [*Euler angles*](https://en.wikipedia.org/wiki/Euler_angles) on Wikipedia
