Home Website Youtube GitHub

Switching from ik to fk is adding rotation

Another strange one…

When swapping from fk to ik (& back) on the legs, an additional rotation is being added to the foot fk control. Any reason why this would be happening ?

I’ve tried this test with the base biped template & it doesn’t happen, so I’m assuming it’s something in my component settings ?

fk legs

I don’t have a concrete answer, but I had the same problem and fixed it once a long time ago. I found I had to do some adjustments to the orientation of the _mth nodes, so they lined up to the components they are supposed to compare to. (But I forget all the specific details, sorry.)

As far as I ever guessed, _mth stood for match? And I noticed some of them seemed to have a rotation similar to the offset when switching.

Oh, I just found a script I wrote for the arms.

I haven’t touched this code since 2019. It might be better to find an actual node it is supposed to match and move it to match. Instead, I hard-coded some values. I hope this gives you some clues for the legs.

import pymel.core as pm
for side in 'LR':
    if side == 'L':
        pm.setAttr("arm_L0_ik_mth.rotateX", 90)
        pm.setAttr("arm_L0_ik_mth.rotateY", 0)
        pm.setAttr("arm_L0_ik_mth.rotateZ", 0)
        
        pm.setAttr("arm_L0_ikCtl_ref.rotateX", 0)
        pm.setAttr("arm_L0_ikCtl_ref.rotateY", 0)
        pm.setAttr("arm_L0_ikCtl_ref.rotateZ", 0)
        
        pm.setAttr("arm_L0_fk2_mth.rx", -90)
        pm.setAttr("arm_L0_fk2_mth.ry", 0)
        pm.setAttr("arm_L0_fk2_mth.rz", 0)
        
        
    if side == 'R':
        pm.setAttr("arm_R0_ik_mth.rotateX", -90)
        pm.setAttr("arm_R0_ik_mth.rotateY", 0)
        pm.setAttr("arm_R0_ik_mth.rotateZ", 180)
        
        pm.setAttr("arm_R0_ikCtl_ref.rotateX", 180)
        pm.setAttr("arm_R0_ikCtl_ref.rotateY", 0)
        pm.setAttr("arm_R0_ikCtl_ref.rotateZ", 180)
        
        pm.setAttr("arm_R0_fk2_mth.rotateX", 90)
        pm.setAttr("arm_R0_fk2_mth.rotateY", 0)
        pm.setAttr("arm_R0_fk2_mth.rotateZ", 180)

Or, if it doesn’t happen in the biped template, then maybe there is just some offset in your leg, where you’ll need to make sure it’s all lined up properly and planar, with no sideways translation or rotation.

(Also, this could really likely be considered a bug. Ideally there would be a way to fix it in any pose.)

1 Like

I think the issue is from the foot locators placement. The component expects the foot is stratight relative to the foot direction.
I need to test for 100% confirmation

1 Like

Thanks for your input guys !

Yes, it was indeed translation on the foot locator placement causing the issue. Once I zero’d this out it’s working perfectly. It does mean the bone is slightly off from where I’d ideally place it based on the model stance, but not enough to effect deformation.

Thanks for both your help :slight_smile:

1 Like