This should be really simple to do (in theory).
I want to take any armor piece (e.g. torso armor from some free monster I downloaded and added to my game) or EVEN a rigid piece of armor from some non-animated statue that happened to be a separate mesh. Given very little input from me (like I might position it, scale it, and rotate it over my rigged character) and then I want to create a skinned mesh from it that is auto-weighted to the nearest bones in my rig. Let’s say that torso armor had the stubby arms pointed outward, well then I just have to make sure my character is in a T-pose before doing the auto-weighting. After running the algorithm, the skinned mesh should look PRETTY CLOSE to the same rigid piece until I animate the bones.
The calculations should be fairly straight-forward and I should be able to get a lot of armor pieces to work (somewhat) with my characters. Is there anything out there right now that can do this? Any code samples? I would greatly appreciate any guidance. As of now, I only have rigid objects for my characters (like swords, axes, shields, and helmets). Yes, they’re naked.
Thanks in advance!!
p.s. I do understand that not everything is going to work automatically. I might have parts of the body extruding through a shirt and it requires manual intervention with Blender. But, if I can get the majority of my armor pieces looking okay without leaving Unity, that would be great! Better yet, I’d like to make small adjustments right inside the Unity editor! But, for now, I just want to auto-weight meshes to my rigs.
Parenting a rigid piece of armor works for some things but not all. A helmet, for example, does not need to flex so I can take it, as is, and parent it to the head bone. I do have some meshes, like a torso mesh, that I only have as a rigid mesh that I’d like to be a skinned mesh. Or, more importantly, I have other skinned meshes like body armor and leg armor that I want to get working with my rig so I’d like to automatically weight it to my rig somehow.
Last night, I did try to take a stab at this problem but my procedurally generated GameObject with SkinnedMeshRenderer had nothing visible at all even though its mesh showed having over a thousand verts and triangles. I did notice that it didn’t properly calculate the bounds though (it said it was 0x0x0).
I’m hoping someone has done something like this and I could use their code.