Home Website Youtube GitHub

3 Joint leg flipping problem

yeah I can replicate the issue


though out of curitosity how was it setup originally when it was generated?

The body itself is all mGear but all of the extra stuff. Face rig harness ect are all built by hand. I can’t detach anything without breaking more things.

@dew can you rebuild your rig? data-centric style?

Unfortunately I’m a bit past the point of rebuilding anything. Deadline ect, all of the extra pieces i built by hand are already very integrated onto the final rig sadly.

appologies if this does not help, would it not be possible then to make a new rig for the legs and then combine it with the old one to replace it?

No worries, I unfortunately have too many things connected to them to take them apart like that.

@Miquel I tried your method again and I think it worked this time. I may have had the order incorrect.

I do have a question about this module specifically. How is it set up differently then the 2Bone Leg. I did notice the 3Bone leg does not use the mGear_IK2FK bone solver node, this is just using the mGear rollSplineKine and matrix nodes to function. Is this using traditional maya IK solvers? Just confused as to why the rollSpline is flipping at 90. I’d like to know more about how these modules are set up so I can better come up with solutions to fix them or avoid flipping like this in a custom module.

Thank you again for all of your help.

1 Like

Awesome! :smiley: Sorry I didn’t had more time to check more carefully all.

yes, and that is one of the things I would like to change in the component. The Maya spring solver is terrible and a lot of workarounding was involved.

yes that will be a really good idea. I think it can be improved.

I’m not super familiar with the Spring solver, but is it being used because the bones are 3 joints instead of two? What would be a good replacement for that if I may ask?

For some reason it doesn’t work on a foot with toe controllers. Not sure why but it wants to rotate the lower joints. It fixes the flipping issue with the offset but seems to effect the foot joints and controllers. I’m not sure what to do. :expressionless: At this point is there anyway to completely disable the roll? I would rather have the lower ankle not roll at all if it will fix the flipping problem.

I found a work around, albeit not the best one.

Okay, so my only solution was to delete those twisting joints from the rig entirely. I wish I knew how the module is using the IK spring solver to be fed into the rollSplineKine. Is it a problem with the spring solver node or the mGear rollSplineKine itself? I know it’s in the other Limb modules and doesn’t flip like that so I was just confused as to why this particular module has this problem. I would love to tackle it if I could get some information about it.

Okay apologies for not reading through the forum more consistently and doing my research outside it. I didn’t realize not only is the spring solver out dated but it’s hidden in maya. Would explain why I never saw it before in the drop down menu. I’ve always rigged quadruped legs with just 2 IK chains, granted this makes having 2 pole vectors a bit annoying to mess with so I can see why having a 3 bone IK would be a lot more warranted.

@Miquel @BlackKnight3K Thanks for all your help!

With that said I would love to see about maybe helping out with trying to come up with a custom spring solver for mGear. Would be very useful instead of using just 2IK chains. What do you guys think?

Someone on the fRigging awesome discord came up with a pretty interesting solution. Seems to be stable. It’s using an orient constraint on the Z axis, pretty much what Miquel did but it has to be fed into the parent CTL on each of the lower leg’s Roll nodes. I’m sure I can probably do this with matrix nodes but it works. Thank you guys for helping out! My client will be happy. If anyone runs into this same problem in the future please let me know and I can break down how it was solved.

3 Likes

Thanks for sharing the information here! I will check and try to implement the solution in the component :slight_smile:

no worries! happy to see you got it worked out :slight_smile:

@Miquel

I hope this helps!

1 Like

yes! it does :slight_smile:

works! thanks. I was just having the same issue

edit: updated the script. it now has a constrain. direct connection wasn’t working

Here a script that can fix the 3bone legs in post custom step.


import mgear.shifter.custom_step as cstp
import pymel.core as pm

class CustomShifterStep(cstp.customShifterMainStep):
    def __init__(self):
        self.name = "00_fixlegs"


    def run(self, stepDict):
        """Run method.

            i.e:  stepDict["mgearRun"].global_ctl  gets the global_ctl from
                    shifter rig build bas
            i.e:  stepDict["mgearRun"].components["control_C0"].ctl  gets the
                    ctl from shifter component called control_C0
            i.e:  stepDict["otherCustomStepName"].ctlMesh  gets the ctlMesh
                    from a previous custom step called "otherCustomStepName"
        Arguments:
            stepDict (dict): Dictionary containing the objects from
                the previous steps

        Returns:
            None: None
        """


        # name of components that needs fixing
        list_components = [
            "legFront_L0",
            "legBack_L0",
            "legFront_R0",
            "legBack_R0"
        ]

        list_components = [stepDict["mgearRun"].components[i] for i in list_components]

        # create new connections to fix the flipping
        self.newconnection(list_components)

        return


    def newconnection(self, fix_list):
        # creates a connection from joint local matrix to through transform outmatrix to ctl parent mgearRollSplineKine
        for e in fix_list:
            # create transform to pass rotateZ value
            fixed_e = pm.duplicate(e.tws3_rot, name="{}_tws3_fix".format(e.fullName))
            # _div6_loc -> _div9_loc
            # list of loc's that need to be fixed
            list_loc = [
                "_div6_loc",
                "_div7_loc",
                "_div8_loc",
                "_div9_loc"
            ]
            for i in list_loc:

                # get the up connection 'mgear_rollSplineKine'
                parentlist_loc = pm.listConnections("{}{}".format(e.fullName, i), type="mgear_rollSplineKine")

                # ctlParent[3] plug the fix transform in the mgear_rollSplineKine
                pm.connectAttr(fixed_e[0].worldMatrix[0], parentlist_loc[0].ctlParent[3] ,force=True)

            # get the orient z of the _legBones2_jnt into the fix transform
            pm.orientConstraint(pm.PyNode("{}_legBones2_jnt".format(e.fullName)), fixed_e[0], skip=['x','y'], maintainOffset=True, weight=1)
4 Likes

This fix is not the best solution. The last joint is not pointing in the right direction. And you have to skin the last part to the end joint. So you should be aware if you use this script.

I was painting weights and my skin was doing weird stuff :crazy_face: