Here’s the problem: I’m attempting to make a segmented knee joint, as seen in the attached file. There’s a gear fixed to the upper leg and a gear fixed to the lower leg; as the knee bends, the gears should not slip or clip into each other.

I have attempted to use inverse kinematics to let Blender do this automatically for me, (again, as seen in the attached file,) but it doesn’t even work consistently in the simplest case, let alone in general. To be specific, what worked best in a single case was, once the proper IK limits had been applied, pushing the stiffnesses of the knee and lower leg as high as they would go. Change the situation at all and that no longer works, nor did it even work reliably in the case I described (still visible on the left leg in the attached file.)

Geared Joint Attempt.blend (1.22 MB)

I have considered using drivers, but the problem is this requires the solution of nonlinear equations, which I have not yet done or seen done with single lines of Python code. Here’s a drawing of the situation:

In the above diagram, L is the distance between the “hip” and “ankle” points, A is the length of the upper leg, B the length of the knee, and C the length of the lower leg. G[SUB]1[/SUB] and G[SUB]2[/SUB] are the number of teeth on the gears attached to the upper and lower legs, respectively, (they don’t have to be the same.)

Angles r, x, and y are the variables I mean to solve for, given constants A, B, C, G[SUB]1[/SUB], G[SUB]2[/SUB], and control input L.

Again, this requires the solution of the equations

y - (G[SUB]1[/SUB]/G[SUB]2[/SUB])*x = 0
A*cos® + B

*cos(r-x) + C*cos(r-x-y) = L

A

*sin® + B*sin(r-x) + C*cos(r-x-y) = 0

Three equations, three unknowns, two are nonlinear. This is the sort of thing I am under the impression that computers are rather good at.

So how do I do this in Blender?