How to rig an IK leg with 2 knee joints I'm trying to rig a leg with two joints and have been struggling for ages trying to add IK. The chain is 4 bones long so forms 2 knees (Fig 1).

Ideally I can imagine having 2 pole targets (Fig 2) but I don't see that the IK solver allows that.

The kind of poses that are difficult to achieve are having the knee joints pointing in different directions. This can be achieved by rotating the bone between the joints but it is awkward to animate and you lose the connection to the pole target (Fig 3)

Does anyone have any ideas how to rig this effectively?

Thanks!

Fig 1



Fig 2



Fig 3 (top view)
So, here is the solution we've found:


Create a controller for your foot, deparent it, parent the foot to this controller.
Choose this controller as the Target of your calf's IK.
The Chain Length of your calf's IK constraint must be 2.
Create a new controller at the bottom of your bone D.
Parent this second controller to the foot controller (Keep Offset).
Parent the pole target of your calf to the foot controller (Keep Offset).
Add a Copy Location constraint to your foot so that it sticks to the calf.
Add a Damped Track or an IK constraint to the bone D and choose the new controller as your Target


Also note that you can limit the IK bones rotations in Properties > Bone > Inverse Kinematics, or with a Limit Rotation constraint, depending on the bones and the chosen solution.