title: Three.JS - Share skeleton between SkinnedMeshes using same bones structure
body: <p>I have been struggling to find a way to add/remove clothing pieces to an existing skeleton <strong>(Clothing meshes and body meshes should share skeleton)</strong> but I always end up getting funny/weird results.</p>
  <p>All the clothing pieces that I'm looking forward to attach to the shared skeleton have been exported on Blender with the same skeleton, <strong>they all share same bone-names and structure</strong>, which I thought it would make it very straight forward.</p>
  <p>I've used these same 3D files on Native iOS SceneKit, I literally just did something like <code>clothing.skeleton = body.skeleton</code></p>
  <p>But as I said, on Three.JS doesn't seem that straight forward.</p>
  <p>I've tried stuff like</p>
  <pre><code>clothingMesh.bind(bodySkeleton,clothingMesh.worldMatrix);
  </code></pre>
  <p>Also tried:</p>
  <pre><code>clothingMesh.skeleton = bodySkeleton;
  bodySkeleton.update();
  </code></pre>
  <p>But always ending up with weird results. I've seen some code that use &quot;ratargeting&quot; functions, but I believe these are used only when skeleton bone names don't match, which is not my case.</p>
  <p><strong>JSFiddle playground</strong></p>
  <p>I've been playing around with it thru JSFiddle <strong><a href="https://jsfiddle.net/cabada/sxv4kbnm/" rel="nofollow noreferrer">https://jsfiddle.net/cabada/sxv4kbnm/</a></strong> where there is a full code where I'm trying to build the concept.</p>
  <p>Another of my goals with fixing how skeletons bind, is to be able to copy Skeleton animations from other sources, so I can download them on the fly and apply them to my characters dynamically. But again, getting weird results, animated skeleton also shares same bone names and structure than target skeleton to animate.</p>
  <p><strong>Resources &amp; examples I have found online related to the topic</strong></p>
  <p><a href="https://raw.githack.com/funwithtriangles/three.js/dev/examples/webgl_animation_sharedskeleton.html" rel="nofollow noreferrer">https://raw.githack.com/funwithtriangles/three.js/dev/examples/webgl_animation_sharedskeleton.html</a></p>
  <p><a href="https://rawcdn.githack.com/mrdoob/three.js/r105/examples/webgl_loader_sea3d_bvh_retarget.html" rel="nofollow noreferrer">https://rawcdn.githack.com/mrdoob/three.js/r105/examples/webgl_loader_sea3d_bvh_retarget.html</a></p>
  <p><a href="https://jsfiddle.net/satori99/pay0oqcd/" rel="nofollow noreferrer">https://jsfiddle.net/satori99/pay0oqcd/</a></p>
  <p><a href="https://github.com/mrdoob/three.js/pull/16608" rel="nofollow noreferrer">https://github.com/mrdoob/three.js/pull/16608</a></p>
  <p><a href="https://i.stack.imgur.com/gPMHf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gPMHf.jpg" alt="Illustration" /></a></p>
  <p>Goal is to be able to add/remove clothing pieces to body, making all meshes per character use one single skeleton (to achieve good performance) and as well to be able to add/remove animations coming from other sources.</p>