# Retargeting Marketplace Characters

In this tutorial we are going to explain how to retarget / adjust a character purchased from the Unreal Engine Marketplace to function with Motion.

<mark style="color:blue;">Motion makes use of the UE5 Metarig as demonstrated and used in the Lyra Sample Game. All changes you will find in the Lyra sample game also apply to Motion.</mark>

<mark style="color:orange;">At this point, we recommend using a seperate branch in your VCS or making a backup before continuing.</mark>

### Retargeting a UE5 Character

In this scenario we will cover retargeting a UE5 character from the marketplace to work with Motion. We will use the [Gothic Knight](https://unrealengine.com/marketplace/en-US/product/gothic-knight) asset as example character.

**Duplicate & adjust IKRetargeter**

Make a copy of the IKRetargeter asset `RTG_Mannequin_Motion (found at: Plugins\MotionCore\Content\EpicGames\Characters\Heroes\Mannequin\Rig\RTG_Mannequin_Motion)` in your project's Content folder and open it.

In the details tab, switch the `Target IKRig Asset` to the one of your character (if applicable) and try to play an animation to verify that the retargeting works correctly.

{% hint style="info" %}
Compiling the IKRetargeter asset may result in a few warnings. Re-saving and compiling again should remove those warnings.
{% endhint %}

<figure><img src="https://1607887566-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOs6WOW1vnxaPpQpuqJOE%2Fuploads%2FLmXsryeOq3WFCzrR6DLv%2Fimage.png?alt=media&#x26;token=19f9625a-216a-4316-be8c-0874bd589612" alt=""><figcaption></figcaption></figure>

#### Create Animation Blueprint for Mesh

To get started, create an animation blueprint for the skeletal mesh you intend to use by right-clicking, and selecting `Create -> Anim Blueprint`.

<figure><img src="https://content.gitbook.com/content/Os6WOW1vnxaPpQpuqJOE/blobs/hRu9O2fXNXitiMf6zt4u/ue5-motion-retarget-gk-makeanimbp.png" alt=""><figcaption></figcaption></figure>

In this case it's called `SK_GothicKnight_Skeleton_AnimBlueprint`. Open the Animation Blueprint by double-clicking it.

#### Add Animation Blueprint Logic

Unlike Retargeting in Unreal Engine 4, retargeting the skeletal mesh to use the UE5 skeleton is not neccessary. Instead, we instruct the animation blueprint to copy the pose of it's parent mesh using a `IK Retargeter`.

<mark style="color:blue;">The IK Retargeter used here are also included in the Third Person Starter Pack that ships with Unreal Engine 5.</mark>

In the AnimGraph of the Animation Blueprint, create a new `Retarget Pose From Mesh` node and connect it to the Output Pose.

<figure><img src="https://content.gitbook.com/content/Os6WOW1vnxaPpQpuqJOE/blobs/gWXa1F6pljqt2z02NBBl/ue5-motion-retarget-gk-makenode.png" alt=""><figcaption></figcaption></figure>

Click the newly created node and go to the Details tab. There, select the copy of the retargeting asset you made earlier in the `IKRetargeter Asset` dropdown.

That's it! You successfully created the retargeting animation blueprint for your character mesh. Now, let's add it to Motion.

#### Adding your Mesh to the Motion Character

{% hint style="warning" %}
Do not change the animation blueprint of the `Mesh (CharacterMesh0)` component! This component is needed in order to run the primary animation blueprint. If you do not wish to keep add a new component, you can duplicate the `ABP_Mannequin_Base` and retarget it to your character.
{% endhint %}

Open your `BP_MotionCharacter` and head over to the Components tab.

Select the `Mesh (CharacterMesh0)` skeletal mesh, enable `Hidden in Game` and set `Visibility Based Anim Tick Option` to `Always Tick Pose and Refresh Bones`.

<figure><img src="https://1607887566-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOs6WOW1vnxaPpQpuqJOE%2Fuploads%2FV1N1H8ZsIOuJwV3BLKtr%2F%7B6B27BFC0-3513-465B-A13D-2D68E480CCBC%7D.png?alt=media&#x26;token=3085c3ef-3e50-484c-a959-377020e10a0c" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
If you plan to only use two meshes by retargeting the animation blueprint, you must reverse this step once you have done the retargeting.
{% endhint %}

Select the `FullBody` skeletal mesh and, on the details tab, change the skeletal mesh to your new mesh.

Then, change the `Anim Class` property to be the animation blueprint you created earlier in this tutorial.

<figure><img src="https://content.gitbook.com/content/Os6WOW1vnxaPpQpuqJOE/blobs/WNMAy6Cm4lnIH81i8hPI/ue5-motion-retarget-gk-motionbp-swapmesh.png" alt=""><figcaption></figcaption></figure>

\
To re-add the headless version of your character:&#x20;

* Duplicate the `FullBody` skeletal mesh component.
* Change the Skeletal Mesh to the headless version of your character.
* **Uncheck** `Owner No See`.
* **Uncheck** `Cast Shadow`.

#### Result

Starting a Play-in-Editor session should now result in your new character being shown, with the mannequin being invisible and all animations being applied to the new mesh.
