I've been grappling with the challenge of incorporating and removing clothing pieces to an existing skeleton (Clothing meshes and body meshes should share skeleton) but I always seem to encounter strange results.
All the clothing items that I intend to connect to the shared skeleton have been exported from Blender with the same skeleton, they all possess identical bone names and structure, which led me to believe it would be a simple process.
I managed to achieve this effortlessly in Native iOS SceneKit by simply performing something like
clothing.skeleton = body.skeleton
However, when attempting the same in Three.JS, it didn't prove as straightforward.
I experimented with approaches such as
clothingMesh.bind(bodySkeleton,clothingMesh.worldMatrix);
And also tried:
clothingMesh.skeleton = bodySkeleton;
bodySkeleton.update();
Yet, the results were consistently odd. While exploring solutions, I came across some code utilizing "retargeting" functions, though these are typically used when bone names of skeletons do not align, which isn't my case here.
JSFiddle playground link:
I've been tinkering with this on JSFiddle through this link, where you can find the complete code detailing my attempts.
In addition to resolving the binding issues with skeletons, my aim is to replicate Skeleton animations from different sources so they can be downloaded on-the-fly and applied dynamically to various characters. Unfortunately, I'm encountering bizarre outcomes even when the animated skeleton shares identical bone names and structure with the target skeleton for animation.
Here are some online resources and examples related to this topic:
Example 1
Example 2
https://i.sstatic.net/gPMHf.jpg
The ultimate goal is to seamlessly integrate and remove clothing pieces from a character's body, ensuring all meshes utilize a single shared skeleton (for optimal performance), and simultaneously facilitate the addition and removal of animations from external sources.