I'd like to share my No-Flip solution to quadruped legs rig. I'll briefly explain the initial leg rigs, but will focus primarily on the No-Flip nature of them. If you want more information on the initial rigs, check out the links above.
As with any IK solver, flipping is a common and troublesome problem. Once the IK handle breaks the IK origin's plane, the knee flips around. This is almost never a desirable effect. So here's my No-Flip solution.
No-Flip Tutorial {
Duplicate the joint chain, rename to "02"s, and remove "wrist_02_jt". Add an IK RP solver from "shoulder_02_jt" to "foot_02_jt" (kneeIK). Create a locator called "knee_PV" and use it as a poleVectorConstraint with "knee_IK". This will be our driver IK.
Add another RP IK from "shoulder_01_jt" to "wrist_01_jt" and name it "ankle_IK". Group it, place the group as a child of "elbow_02_jt", and snap-drag its pivot (hold d+v) to "foot_01_jt". This allows the wrist to pivot by rotating the "pivotAnkle_grp", while keeping it aligned with the forearm! This is the main genius behind Morgan's rig.
Now let's include the foot and toe. Create a SC IK from "wrist_01_jt" to "foot_01_jt" and name it "foot_IK". Now create another SC IK from "foot_01_jt" to "toe_01_jt" and name it "toe_IK".
Let's make a control handle. Create a NURBSCircle, name it "foot_ctrl", and snap it (hold v) to "foot_01_jt". Place all the other IKs under it ("knee_IK", "foot_IK", "toe_IK").
We have now completed the Foreleg rig by Morgan! Now let's make it No-Flip!
Create a 2-length joint chain and snap-drag (hold v) it to start at "shoulder_01_jt" and extend to "foot_01_jt". Add a RP IK to it and name it "helper_IK". Now move "helper_02_jt" up until it is half-way up the leg. Since we made the IK first, movement of the joint will be constrained by the IK for us! This joint chain will be used to keep our "knee_PV" in line with the knee at all times.
Create a locator named "helper_PV", snap-drag (hold v) it to "helper_02_jt", and translate it in Z (if your joints are on the XY plane like mine). Now poleVector constrain "helper_IK" with it. This will keep our helper joint chain from flipping, and thus our knee. (To see what I mean, disable this constraint after the last step).
We need the "helper_PV" to stay between the shoulder and foot, and always on the same side of them. So to avoid getting rotations, we'll use a pointConstraint. Group "helper_PV", select "shoulder_01_jt", shift-select "foot_01_jt", shift-select "helper_PV_grp", and Constrain->PointConstraint.
Now that our helper joint chain won't flip, we can use it to drive the knee PV. Group "knee_PV", select "helper_01_jt", shift-select "knee_PV_grp", and Constrain->ParentConstraint. The group allows for animation of "knee_PV" after the constraint.
That's it! Give it a trial test to see exactly what this rig gives you in comparison to a normal IK setup. It should not flip in the XY plane at all! This should give your characters much more freedom of movement forwards and backwards. And it automates the PV's, so no need to animate PV's every step!
I hope this helps with your quadruped rigs! Thanks again to Morgan Loomis for allowing me to use his awesome foreleg rig! I will be posting a No-Flip solution to his hindleg quadruped rig soon!
Feel free to comment if anything is unclear! I'd love to hear some feedback!
-K
Hi Katlan! I'm trying to implement your fix on a quadruped rig of my own but I'm stuck on step 5. I made a 2-joint chain from the shoulder to the foot and made an RP ikHandle, but the handle follows the joint on the end of the chain when I move it. Yours doesn't seem to do that; it sticks to the foot joint. Am I missing something?
ReplyDeleteHey Caitlin, thanks for commenting!
DeleteWhen you make the RP IK make sure "sticky" is ON, and "snap" is OFF. You can do this in the Tool Settings panel while making the IK, or afterwords in the Attribute Editor of the ikHandle, under the "IK Handle Attributes" section.
I should have mentioned that detail in the tutorial. Thanks for asking! Hope this helps!
It did, thank you! One more question, though, if you don't mind. I moved past that problem but got stuck again on the last portion of step 7. When I try to parent the knee locator group to the helper joint, I get a "may not cycle as expected" error message. Could that be a parenting issue somewhere? Also, how did you get the helper joints to stay with the rest of the leg when moving, say, the hip?
DeleteHey Caitlin,
DeleteSo your second problem is just another easy step. Make a group under the "foreleg_rig_grp" and call it "hip_grp" and snap its location to "shoulder_01_jt", and freeze transforms. Place all three shoulder joint chains under it ("shoulder_01_jt", "shoulder_02_jt", and "helper_01_jt"). Now moving the "hip_grp" should move the hip with all the joints. You can then parent this into your rig!
The cycle error is because your rig isn't maintaining a single direction of data flow. By this I mean all data connections (constraints, connections, parents, expressions) must flow down the rig. If you have a parent, A, and a child of that parent, B, you cannot constrain A with B, since that circles back up the chain. Does this make sense?
In your case, it could be a number of things. Make sure you didn't use the kneePV to pole-vector constrain the helperIK. Make sure the helperPV is not being constrained by the helper_jts. Make sure you're using a pointConstraint on the helperPV and a parentConstraint on the kneePV. Make sure your heirarchy looks like mine. Sorry I can't pinpoint it exactly...
Did this help?
I think my problem might have something to do with the fact that I'm trying to adapt your foreleg rig to a rear leg joint chain.
DeleteAh yeah a lot changes with the hind-leg. If you're using Morgan Loomis's rig, I am planning to do a follow-up post for a no-flip hind-leg based on that. Should be one of my next posts. Good luck to you!
DeleteThat would be wonderful! Thanks for all your help, Katlan.
DeleteNo problem, Caitlin. Thanks for commenting! (You're the first)
DeleteAnd I am eagerly awaiting the chance to be the first to comment on the next leg fix! :)
DeleteKatlan! I am dying to know how you prevent flipping in the hind leg! You never uploaded a tutorial like you promised!
ReplyDeletePlease please please!!!
Hey there Anonymous. You're entirely correct, and I apologize. I'm back to blogging now, so I'll consider posting the no-flip hind leg as my first new post!
DeleteHi Katlan,
ReplyDeleteProblem after step #4 pic 8 of 15 shows a toe_IK, and a foot_IK, but you don't mention making those IKs, only to be sure to place them all under the control?
Hey Sean,
DeleteNice catch! They're both just ikSCSolvers. "foot_IK" connects the wrist to the foot joint. "toe_IK" connects the foot to the toe joint. I'll edit the tutorial to include them. Thanks!