# Issue loading/retargeting animations

**URL:** <https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313>\
**Category:** Questions\
**Tags:** animation, animations\
**Created:** [March 10, 2022, 4:42pm UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313 "2022-03-10T16:42:24Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterdijkstra](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@peterdijkstra](https://forum.babylonjs.com/u/peterdijkstra)\
**Post date:** [March 10, 2022, 4:42pm UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/1 "2022-03-10T16:42:24Z")

</div>

Hi,

For a client I need to be able to load any Ready Player Me model and apply an animation to it. Loading the RPM model is easy since it’s just a GLB file, but I am having trouble playing/retargeting animations on them. I am using Mixamo animations, which use the same bone structure, and should work according to RPM. I imported the Mixamo animation in Blender and exported als glb.

The most straightforward way seems to SceneLoader.ImportAnimations(Async). The animation works, but the bones are all stretched out.

 ![Screen Shot 2022-03-10 at 16.44.52](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/5/550edf91f63c955fc1220b3e8566472e1d5d1a0f.png)

I’ve tried all kinds of things, but I can’t seem to get the bones right. I assume something could be done with the targetConverter parameter, but I can’t find documentation on how that is supposed the work.

I’ve also tried just brute forcing replacing targetedAnimation targets, but I can’t get that to work either. (from [here](https://forum.babylonjs.com/t/copy-animationgroup-with-skeleton/19698))

For what it’s worth, the Mixamo animation plays fine on it’s own mesh:

 ![Screen Shot 2022-03-10 at 16.45.25](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/0/f0d69eabf9c682c18ba6e427b678158d5cc8bf96.png)

When inspecting the target of the first targetedAnimation entry in both the imported animation, and the loaded Mixamo mesh + animation, I get wildly different \_absolutePositions.

SceneLoader.ImportAnimations:  
\_x: 24.706941604614258  
\_y: 88.59120178222656  
\_z: 27.140859603881836

SceneLoader.LoadAssetContainer:  
\_x: 0.7434375882148743  
\_y: -0.19256991147994995  
\_z: 1.5141488313674927

The rest of the properties seem to be the same. I tried modifying the scale, but that didn’t do anything. Modifying scaleDeterminant only made things worse, haha.

Any help would be greatly appreciated!

Thanks,

Peter

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 10, 2022, 6:41pm UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/2 "2022-03-10T18:41:32Z")

</div>

Adding @bghgary who is amazing at animation 🙂 Could you provide a repro in the playground ?

---

<div class="post-metadata">

**Author:** ![peterdijkstra](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@peterdijkstra](https://forum.babylonjs.com/u/peterdijkstra)\
**Post date:** [March 10, 2022, 8:46pm UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/3 "2022-03-10T20:46:15Z")

</div>

Thannks for your reply @sebavan!

> **[Babylon.js Playground](https://playground.babylonjs.com/#JQLEGG%232)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Here’s a playground with the big stretchy man!

There’s also a commented out bit for loading the mixamo animation with +y up set in the Blender GLB export. Using that one for ImportAnimation causes the RPM model to be oriented on its side

edit: managed to get the same result in a bit more manual manner: [https://playground.babylonjs.com/#JQLEGG#3](https://playground.babylonjs.com/#JQLEGG#3)

I took the retargeting method from the thread I mentioned in my opening post

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 11, 2022, 5:58pm UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/4 "2022-03-11T17:58:21Z")

</div>

Assigned @bghgary on March 11, 2022, 5:58pm UTC



---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 11, 2022, 11:41pm UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/5 "2022-03-11T23:41:45Z")

</div>

I will take a look, but this will likely take a while. Skinning issues always take a while. 🙂

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 12, 2022, 12:32am UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/6 "2022-03-12T00:32:29Z")

</div>

Of course, since I said it’s going to take a while, it doesn’t take a while, haha.

The problem here is that while these two have the same bone structure, the bone matrices are not the same.

For example, changing the head to 1 unit in the X direction for hiphop does this:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/8/589185b784d042e5685e4e12957822f3d4b36783.jpeg)

While doing the same thing for rpm does this:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/c/cc777cb3768b663f203468de3ac7ee3093c6767a.jpeg)

Hence these are not compatible.

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 12, 2022, 12:37am UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/7 "2022-03-12T00:37:50Z")

</div>

Using [glTF Tools for vscode](https://marketplace.visualstudio.com/items?itemName=cesium.gltf-vscode#:~:text=glTF%20Tools%20Extension%20for%20Visual%20Studio%20Code%201,...%206%20Tree%20View%20of%20Scene%20Nodes.%20), you can see there are big differences in the inverse bind matrices for the glTFs.

These are not in order, but you can see there is at least a scale difference.

hiphop\_yup:

```auto
/accessors/4
[100.00001, 0.00000, 0.00000, 0.00000], [0.00000, 100.00002, -0.00002, 0.00000], [0.00000, 0.00002, 100.00001, 0.00000], [0.00000, -103.99149, -2.07608, 1.00000]
  [100.00001, 0.00000, 0.00000, 0.00000]
  [0.00000, 100.00002, -0.00002, 0.00000]
  [0.00000, 0.00002, 100.00001, 0.00000]
  [0.00000, -103.99149, -2.07608, 1.00000]
[100.00001, 0.00000, 0.00000, 0.00000], [0.00000, 100.00002, -0.00002, 0.00000], [0.00000, 0.00002, 100.00001, 0.00000], [8.20780, -97.23982, -0.47652, 1.00000]
  [100.00001, 0.00000, 0.00000, 0.00000]
  [0.00000, 100.00002, -0.00002, 0.00000]
  [0.00000, 0.00002, 100.00001, 0.00000]
  [8.20780, -97.23982, -0.47652, 1.00000]
[100.00001, 0.00000, 0.00000, 0.00000], [0.00000, 100.00002, -0.00002, 0.00000], [0.00000, 0.00002, 100.00001, 0.00000], [8.20780, -52.86929, -0.76267, 1.00000]
  [100.00001, 0.00000, 0.00000, 0.00000]
  [0.00000, 100.00002, -0.00002, 0.00000]
  [0.00000, 0.00002, 100.00001, 0.00000]
  [8.20780, -52.86929, -0.76267, 1.00000]

```

rpm:

```auto
/accessors/132
[1.00000, -0.00000, -0.00005, 0.00000], [-0.00000, 0.99947, -0.03246, 0.00000], [0.00005, 0.03246, 0.99947, 0.00000], [0.00000, -1.01898, 0.02305, 1.00000]
  [1.00000, -0.00000, -0.00005, 0.00000]
  [-0.00000, 0.99947, -0.03246, 0.00000]
  [0.00005, 0.03246, 0.99947, 0.00000]
  [0.00000, -1.01898, 0.02305, 1.00000]
[1.00000, -0.00000, 0.00000, 0.00000], [0.00000, 0.99449, 0.10484, 0.00000], [-0.00000, -0.10484, 0.99449, 0.00000], [-0.00000, -1.11007, -0.13033, 1.00000]
  [1.00000, -0.00000, 0.00000, 0.00000]
  [0.00000, 0.99449, 0.10484, 0.00000]
  [-0.00000, -0.10484, 0.99449, 0.00000]
  [-0.00000, -1.11007, -0.13033, 1.00000]
[1.00000, -0.00000, 0.00000, 0.00000], [0.00000, 0.98569, 0.16858, 0.00000], [-0.00000, -0.16858, 0.98569, 0.00000], [-0.00000, -1.22961, -0.20984, 1.00000]
  [1.00000, -0.00000, 0.00000, 0.00000]
  [0.00000, 0.98569, 0.16858, 0.00000]
  [-0.00000, -0.16858, 0.98569, 0.00000]
  [-0.00000, -1.22961, -0.20984, 1.00000]

```

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [March 12, 2022, 12:39am UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/8 "2022-03-12T00:39:08Z")

</div>

Unassigned @bghgary on March 12, 2022, 12:39am UTC



---

<div class="post-metadata">

**Author:** ![peterdijkstra](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@peterdijkstra](https://forum.babylonjs.com/u/peterdijkstra)\
**Post date:** [March 12, 2022, 8:39am UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/9 "2022-03-12T08:39:54Z")

</div>

@bghgary Thank you so much!! This’ll definitely help me find a fix. I was hoping I could use the Mixamo animations without any modifications, but I guess I should retarget the animation in Blender and then export it. With some luck it’ll work on different RPM models too then - since that’s only thing I cannot change.

Again, thank you very much. I know next to nothing about the inner workings of skinning and now I know a tiny bit about it 🙂

---

<div class="post-metadata">

**Author:** ![peterdijkstra](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@peterdijkstra](https://forum.babylonjs.com/u/peterdijkstra)\
**Post date:** [March 12, 2022, 4:17pm UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/10 "2022-03-12T16:17:22Z")

</div>

Retargeting the animation in Blender and then exporting it seems to work! The arms are messed up because I couldn’t be bothered yet to get the rest pose right in Blender

 ![Screen Shot 2022-03-12 at 17.16.16](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/0/9037634c4824494acb4120f40643e6d4be6d48c5.png)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 13, 2022, 3:39pm UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/11 "2022-03-13T15:39:05Z")

</div>

@bghgary you are now my go to person for animation for life 😉 Thanks

---

<div class="post-metadata">

**Author:** ![peterdijkstra](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@peterdijkstra](https://forum.babylonjs.com/u/peterdijkstra)\
**Post date:** [March 15, 2022, 11:52am UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/12 "2022-03-15T11:52:17Z")

</div>

Alright, I’ve found the REAL fix

Turns out that in the Ready Player Me Unity SDK, there are two FBX files, male and female animation targets, that you can upload to Mixamo to handle the retargeting there. Then you can download the retargeted animations in FBX format. Export those to GLTF from Blender and they just work!

---

<div class="post-metadata">

**Author:** ![Shivam\_Malhotra](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/shivam_malhotra/32/23071_2.png) [@Shivam\_Malhotra](https://forum.babylonjs.com/u/Shivam_Malhotra)\
**Post date:** [March 26, 2022, 12:39pm UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/13 "2022-03-26T12:39:58Z")

</div>

@peterdijkstra I have been working on a similar setup wherein I need to use mixamo animations on RPM GLB models. Could you please point out which FBX files are you referring to?  
Is it RPM\_Avatar\_Reference.fbx?

---

<div class="post-metadata">

**Author:** ![peterdijkstra](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@peterdijkstra](https://forum.babylonjs.com/u/peterdijkstra)\
**Post date:** [March 27, 2022, 7:55am UTC](https://forum.babylonjs.com/t/issue-loading-retargeting-animations/28313/14 "2022-03-27T07:55:41Z")

</div>

@Shivam_Malhotra They’re called MaleAnimationTargetV2.fbx and FemaleAnimationTargetV2.fbx, in the Unity SDK download! See [Loading Mixamo Animations in Unity - Ready Player Me](https://docs.readyplayer.me/integration-guides/unity/loading-mixamo-animations)
