- Home /
Animations become faulty when imported into Unity
Hello fellow game developers,
I just imported a bunch of animations into Unity and some of them act very strange when I apply the character avatar. It's only a handful of animations, and it appears that the problem is mostly only affecting the arms. We tried reexporting and importing the animations from maya, but it had no effect. The animations are baked and exported as FBX.
Any ideas what could be going wrong?
Looks like your avatar has an issue. Humanoid rig? On the Rig import tab, click on Configure... and make sure all the bones are mapped properly. Don't map to twist bones if you have any. From the screenshot, it looks like your model was exported 180 degrees from what Unity expects. I bet the limbs assignments are switched. The best solution is to rotate the model 180 in $$anonymous$$aya and re-export.
If the arms were switched, wouldn't all my other animations be screwed up too? If the character is facing the forward direction, isn't it working, or is the problem in relation to something else?
Are the animations exported separately - if so, are the scales correct on all of the in the importer?
Do other arm animations work correctly? I ask because I have some older models where -Z is forward. $$anonymous$$ecanim's humanoid auto-mapping assumes +Z is forward, so it swaps the limbs and the result looks exactly like your screenshot.
I also have some old Biped models with twist bones that get auto-mapped, and they look similar, too.
If other arm animations do work correctly, then it's probably a scaling issue like @whydoidoit suggests.
Does the muscle preview work as expected?
Glad it's working at least. $$anonymous$$aybe your animator had some scaling on the arms of those animations. (BTW, you can check scale on the Import tab of the FBX Importer inspector, located to the left of the Rig tab.)
Answer by vonlindberg · Oct 27, 2016 at 02:53 PM
Hello! I know this issue is old and has been resolved for the original poster, but I had this same issue and managed to figure out the cause.
Unity's animation system applies constraints to the joints of an avatar, so that animations wont move the character in an unnatural way (for that character). I believe Unity does something approximately along the lines of clamping the f-curves to the allowed angles, and if you transgress the maximum angle for a joint too far, then it can end up getting clamped around to the minimum value, which results in a dislocated joint.
The fix for this is to apply proper constraints to your rig in your animation software, so that your joints work the same as those of the avatar in Unity. If you want your character to be able to bend some joint in an unnatural way, I believe you have to tweak the muscle settings in the avatar configuration.
The arms seem to be the general offender here, as it easily happens that you either roll the shoulder bone, or yaw the lower arm bone. Neither of these motions can happen in a normal human skeleton. It looks like the former is what was haunting the original poster, while I had problems with the latter.
Regards
Answer by theANMATOR2b · Oct 28, 2016 at 07:33 PM
"as it easily happens that you either roll the shoulder bone, or yaw the lower arm bone. Neither of these motions can happen in a normal human skeleton."
May consider explaining this a bit simpler instead of using camera movement terminology, so others - non-animators can comprehend.
As an animator myself - I translate the explanations to mean - rotate the shoulder bone around it's local axis = roll, and - I'm really not sure what yaw a lower arm bone means, since rotating a lower arm bone from its pivot point located at the joint of the parent bone is a proper animation process for FK/IK rigs. What type of translation/rotation does "yaw" represent?
Thanks for the clarification.
$$anonymous$$aybe I was a bit fast in my choice of ter$$anonymous$$ology. As you interpreted correctly, by roll I mean rotations around the the bone's symmetry axis.
$$anonymous$$y usage of yaw was a bit ambiguous since it usually refers to a rotation around the vertical axis and it's not obvious which axis that is in the lower arm's reference system. To be more clear: the lower arm works like a hinge, it can rotate up towards the upper arm around one axis only. If you extend your arm forwards, with your elbow pointing downwards, you can not turn your lower arm to the left or right, because the joint does not allow it. Rotations around this axis is what I meant by yaw.