0
$\begingroup$

I made a character, gave it 8 animations that look great (as good as I could) in Blender and they break down in Unity. What else is new.

The problem has to do with the constraints "fighting" when the animations are baked. The rig involves IK constraints on the spine and both arms, Copy Scale constraints, and a Limit Scale constraint. By default, scaling a parent bone causes its children to scale uniformly as well. I changed this in the Relations settings for some bones to "Inherit Scale: None". I do not think this is acknowledged in Unity.

ANYWYAY!

In Unity, there is weird stretching in some animations. I can replicate these problems in Blender if I bake the animations and choose to apply the constraints. Again, this seems to do with Blender not knowing how to replicate the resultant transformations from the constraints.

What I would like to try is duplicating the rig I have, deleting the non-deformation bones, deleting all bone constraints, and baking all the resultant transformations from the original rig to this new rig, and using this new rig to animate. I saw a video that did this a while ago but I can't find it.

Is this solution going to work? How can I set this up?

Here are 2 example animations, success/failure:

"Close" (success in Blender, no weird stretching):

https://www.deviantart.com/onewingedchronothing/art/ChimpInTheBox-Close-852627603

"Close" (failure in Unity):

enter image description here

"Sweep" (success in Blender, no weird stretching):

https://www.deviantart.com/onewingedchronothing/art/ChimpInTheBox-Sweep-852359442

"Sweep" (failure in Unity):

enter image description here

$\endgroup$
1
$\begingroup$

I succeeded in saving our character but the way I did it was hard-won. I hope this will be helpful to others who learn the hard way that their armature is not setup to be interpreted properly by Unity. Note that I have been advised by a professional that this is over-complicated compared to the minimum that really needed to be done to "save" the character, but the optimal solution apparently does involve a copy-transform rig.


I duplicated the armature I had and removed all the non-deformation bones from it. Then I cleared all its ("Armature.001") bones' constraints, disconnected and de-parented all of them, and re-parented all of them to the root bone. I put a "Copy Transform" constraint on the root with the other Armature as the target, but did not set the bone target. Then I copied that constraint to all other bones at the same time. One-by-one, I set the bone target to the bone with the same name in the other rig. This took about 10 minutes just to be thorough.

Now I was ready to re-create the actions: In the Action Editor, I set the active action for each armature to the same action. With the new armature selected, I clicked the button to make a new action: "ActionName.001" In pose mode, I selected all bones, set my Keying Set to "LocRotScale", and re-keyed every single frame. (I did this for every Action). Through trial-and-error, I determined that I needed to bake these actions one-at-a-time with the following options activated:

  • Only Selected (not required, probably)
  • Visual Keying (most important)
  • Clear Constraints (equally most important :) )
  • Overwrite Current Action (preference)

I was only able to remove the constraints ^ and have the new armature continue to respond to the keys when it was done this way. I also remembered to delete the channels belonging to the non-deformation bones that didn't exist anymore. I did this after baking just to make sure it wasn't causing problems.

After clearing constraints, the other actions break. I anticipated this, and every time I baked an action, I saved it in its own file.

Finally, from the file version before all this baking happens, I removed all the actions, deleted the original armature, and appended THE ONE BAKED ACTION from each new file I saved. DO NOT FORGET to append JUST THE ONE YOU BAKED from each file each time, otherwise you will think you messed up when you are just appending the wrong action from the wrong file. Obviously, I got very nervous for a second because I forgot!

When all the animations were appended, I was able to export. Before I did, I de-parented all meshes and rotated everything about the X-axis by -90 degrees, applied that rotation, and rotated it back 90 degrees. This corrects the axis disparity between Blender and Unity.

Here is evidence of my success (sorry, it was too big to embed): https://imgur.com/a/zv8MtqU

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.