# Streaming Mocap Data into Unity

**Unity** is one of the most widely used 3D and 2D game engines in the world. Its strengths lie in real-time rendering and extensive development flexibility. Unity is used not only for game development but also across a variety of industries including virtual production, animation, simulation and interactive content and installations.

With MOVIN TRACIN and MOVIN Studio, you can stream motion capture data directly to Unity, allowing for seamless integration into real-time projects such as games, XR experiences, or live productions.

{% hint style="info" %}
For live streaming to Unity, please download the plugin from [MOVIN’s official page](https://www.movin3d.com/downloads#movin-studio).
{% endhint %}

{% embed url="<https://youtu.be/YvixQUdV1PQ?si=AltZ5XQSiSy9I3Gs>" %}

{% stepper %}
{% step %}

### Download the Unity Plugin

<figure><img src="https://935889915-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpjitYtIcckwQaYBZMIj0%2Fuploads%2FQBpZm5XQfWANMYL7PLuT%2Fimage.png?alt=media&#x26;token=277854c2-7b7d-46be-becd-c2515d2c5945" alt=""><figcaption></figcaption></figure>

* On the [MOVIN's official page](https://www.movin3d.com/downloads#movin-studio) , click 'Download Unity Plugin' and download the file to get the UnityPackage file for streaming.
  {% endstep %}

{% step %}

### Import & Retarget Your Character in MOVIN Studio

<figure><img src="https://935889915-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpjitYtIcckwQaYBZMIj0%2Fuploads%2FHZOqDkEuyDNnekIOn6Id%2Fimage.png?alt=media&#x26;token=e0d650d8-f93f-4f32-9f43-6c8da743cde1" alt=""><figcaption></figcaption></figure>

* Please import the FBX file of the character you want to use in Unity into MOVIN Studio.
  * For detailed instructions on this process, please refer to [import-custom-character](https://help.movin3d.com/movin-studio-usage-guide/import-custom-character "mention")

* After importing the character, proceed with retargeting.
  * For detailed instructions on this process, please refer to [retargeting](https://help.movin3d.com/movin-studio-usage-guide/retargeting "mention")
    {% endstep %}

{% step %}

### After opening the unity project, please import the UnityPackage

<figure><img src="https://935889915-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpjitYtIcckwQaYBZMIj0%2Fuploads%2FPcQmV7MQmfIZk1EN0oaY%2Fimage.png?alt=media&#x26;token=9761a8e9-2d83-42cf-b01d-7a59cac39a71" alt="" width="188"><figcaption></figcaption></figure>

* Please open the unity project, then import the UnityPackage that you downloaded in the [#download-the-unity-plugin](#download-the-unity-plugin "mention")

{% hint style="warning" %}
The plugin (UnityPackage) provided MOVIN is compatible only with Unity version 2021 or later. If you are using a Unity project with a version earlier than 2021, please upgrade your Unity version.
{% endhint %}
{% endstep %}

{% step %}

### Please add the Mocap Receiver script to the top-level Bone (GameObject) of the character's skeleton that receives motion data

* Import the FBX character you want to use in the Unity project and place it into the Scene

<figure><img src="https://935889915-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpjitYtIcckwQaYBZMIj0%2Fuploads%2FMm13HAkXbsAtyESmkVGr%2Fimage.png?alt=media&#x26;token=dc5b330a-1c2b-413a-a061-786eecc42b2e" alt="" width="188"><figcaption></figcaption></figure>

* Select the top-level GameObject (Root bone) of the character.&#x20;
  * In this example, it is `mixamorig:Hips`
  * In the **Hierarchy** window, expand the character GameObject to view its skeleton.

    You’ll see a structure made up of multiple bones (GameObjects) connected in a parent–child hierarchy, such as the spine, arms, legs, and head.

    At the top of this skeleton hierarchy is the **Root Bone**, which serves as the reference point for applying motion to the character.

<div><figure><img src="https://935889915-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpjitYtIcckwQaYBZMIj0%2Fuploads%2FvRmFJ2exzXF8kbYAovBN%2Fimage.png?alt=media&#x26;token=edc3cadc-db7b-443c-9fc7-dfe6490be12e" alt="" width="188"><figcaption></figcaption></figure> <figure><img src="https://935889915-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpjitYtIcckwQaYBZMIj0%2Fuploads%2FwmcWX3mnYUog64z4qwV4%2Fimage.png?alt=media&#x26;token=c2a0965c-bd56-4fa2-89e3-d18ab0b947d7" alt="" width="188"><figcaption></figcaption></figure> <figure><img src="https://935889915-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpjitYtIcckwQaYBZMIj0%2Fuploads%2Fr5TWPgktwT5IqepaNpUT%2Fimage.png?alt=media&#x26;token=26008d41-0cd1-4577-b462-27f79ec301bf" alt="" width="188"><figcaption></figcaption></figure></div>

* With the Root Bone selected, open the Inspector window and click : \
  Add Component > Scripts > MOVIN.Core > Mocap Receiver. \
  This adds the 'MocapReceiver.cs' script to the Root Bone, allowing it to receive and apply motion data.&#x20;
  {% endstep %}

{% step %}

### (MOVIN Studio v.2.0.0 or later) In Bone Search Filter > Root Bone Name, enter the name of the root bone

{% hint style="danger" %}
This step is only required for plugins version MOVIN Studio v.2.0.0 or later. If you are using a version earlier than MOVIN Studio v.2.0.0, please refer to  [#movin-studio-version-earlier-than-v.2.0.0](#movin-studio-version-earlier-than-v.2.0.0 "mention")
{% endhint %}

* The **Bone Search Filter** searches for all bones under the hierarchy of the bone specified as Root Bone Name, and maps them 1:1 with bones that have the same names in the character imported into MOVIN Studio.&#x20;
  * If the Root Bone Name is not specified, the plugin uses the character’s default Root Bone (Transform) in the skeleton hierarchy as the reference.
* Please carefully review the character's bone hierarchy and set the Root Bone Name accordingly.&#x20;
  * Depending on the Root Bone Name is set, only part of the motion data streamed from MOVIN Studio may be applied, or the motion may not be applied correctly.&#x20;

{% endstep %}

{% step %}

### (MOVIN Studio version earlier than v.2.0.0) Add the Actor Script to the parent&#x20;

{% hint style="danger" %}
This step is only required for plugins version MOVIN Studio version earlier than v.2.0.0. If you are using MOVIN Studio v.2.0.0 or later, please refer to [#movin-studio-v.2.0.0-or-later-in-bone-search-filter-greater-than-root-bone-name-enter-the-name-of-th](#movin-studio-v.2.0.0-or-later-in-bone-search-filter-greater-than-root-bone-name-enter-the-name-of-th "mention")
{% endhint %}

* Find the Hip Bone (such as `mixamorig:Hips`) in the Hierarchy window.\
  Select the GameObject that is directly above it in the hierarchy (the parent GameObject).
* Next, open the Inspector, click Add Component, and add the 'Actor.cs' script.
  {% endstep %}

{% step %}

### Start Streaming in MOVIN Studio

<figure><img src="https://935889915-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpjitYtIcckwQaYBZMIj0%2Fuploads%2FjRpEzlVzE36HFIQ1Xmzo%2FGroup%2035.png?alt=media&#x26;token=bf53c679-6a1a-402f-8bbc-366dcd6d4416" alt=""><figcaption></figcaption></figure>

* Return to MOVIN Studio and select the Streaming Tab.&#x20;
* If Unity and MOVIN Studio are running on the same PC, the Host should be set to `127.0.0.1` (localhost)
* Check that the Listen Port set on the GameObject in your Unity Project matches the Port Number configured in MOVIN Studio.&#x20;
* Set the Platform to Unity in MOVIN Studio, then click the Start Streaming button to begin streaming&#x20;
  {% endstep %}

{% step %}

### Click Play button in Unity Project

* You should now see motion data from **MOVIN Studio** streaming into **Unity** in real time.

<figure><img src="https://935889915-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpjitYtIcckwQaYBZMIj0%2Fuploads%2F7BV4aWhVrSYmBsp9Vriy%2Fimage.png?alt=media&#x26;token=b5334e98-c635-4dc0-9771-faf016a403b6" alt="" width="375"><figcaption></figcaption></figure>

* Inside the UnityPackage, MOVIN > Scenes folder includes three sample Scenes that are already set up.
* If you run into any issues with the Unity setup, check these Scenes to check the configuration.
  * Sample\_MOVINman\
    This sample can be tested without loading a character in MOVIN Studio.
  * Sample\_Ch14 and Sample\_Ch29\
    These samples require you to load the corresponding FBX characters with matching names in MOVIN Studio.

{% endstep %}
{% endstepper %}


---

# 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://help.movin3d.com/movin-studio-usage-guide/live-streaming/streaming-mocap-data-into-unity.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.
