Edit: It looks like I can get this to happen any time that I extend an IK handle fully and try to use it in a humanoid rig in Unity. Any insight as to why that happens would be appreciated. Otherwise, I might just have to add a bit of bend in any place that happens.
This has been driving me crazy today. Any debugging suggestions are greatly appreciated. I’ve posted on Maya forums as well because I’m not sure where my issue is.
My character’s left knee jerks sharply inward when its leg is fully extended. This doesn’t happen in Maya, only in Unity. It also doesn’t happen to the character’s right knee. If I import to Unity as a generic rig, it works fine, but if I import as a humanoid, this glitch starts happening.
The leg is a pretty simple IK handle between the ankle and the top of the leg. The knee is controlled by a pole vector constraint on the IK handle.
It seems from this answer that Unity creates a new, generic rig when you use the “Humanoid Rig” import option. This rig has an IK handle on each limb. This answer on the reddit post Animation glitch when importing to Unity discusses how IK handles can only bend in one plane. That plane is defined by the IK handles pole vector. It seems in the generic humanoid rig that Unity does not give you control over the pole vector plane and that the plane is always aligned with the character’s forward and up vectors.
This means that whenever the limb extends to the point that there is no bend in the IK handle, the IK handle’s rotation defaults to the rotation of the pole vector, which is forward (or backward depending on which is closer, as planes aren’t directed). In my case, this results in the animations for forward running looking fine but the animations for strafe running getting this rotation glitch.
I unfortunately don’t have a good solution, though. It just seems like, if you want to use Unity’s humanoid rig to retarget animations, you can’t have animations with fully extended limbs that are rotated off center.