0
$\begingroup$

I'm working on a rig for a robotic leg and I want to have a simple, 2-axis joint connected to the foot (see screenshot).

enter image description here

However, I can't seem to get the joints to only move on their axes. I can get them to lock in relation to the bone above them, but I need them to lock to global axes (I want the foot to be flat on the floor). Here's what's happening now:

enter image description here

I'd like to be able to move the foot bone around and have the joints swivel on the correct axes.

Thanks to anyone who can help!

.blend File:

$\endgroup$

1 Answer 1

2
$\begingroup$

Let's deal with few introductory problems.

First, you have constraints on your objects, which you shouldn't. By parenting to bones and copying rotation from those bones, you're double dipping on the rotation of the constrained bones. So first, we'll remove all object constraints. (I'm willing to bet these are just vestigial from trying to work around the problem anyways.)

Second, to address something in question, you don't want to lock global axes. If you locked global axes, and then you rotated your robot body 90 degrees, those axes would flip. You don't want that. You want local axes, which, conveniently, is how IK locks and limits work anyways.

Third, we need to consider the shape of the robot leg. This leg has an enormous amount of rotation in one axis (corresponding with world X in your file), but has absolutely no capacity to twist along the axis of the bones-- no bones have any Y rotation. So, as built, there are just an awful lot of ways that this can't move. And for the ways that it can move, it has huge redundancy, and is going to move the long bones before it moves the short bones, because those allow the foot to move further with smaller angles.

Okay, that out of the way, we'll fix the problem.

Cube.004 needs to rotate only in specific ways depending on the final bone in the IK chain, but it is not part of the IK chain. It would be easiest to include Bone.002 in the IK chain. So first, we'll make a new bone at the location of the tail of Bone.002, give it the IK constraint with a chain length 1 longer, and parent it Bone.002 to Bone.003.

enter image description here

Now that we've done that, we can use appropriate axis locks for the bones, based on their axes-- that's why I've enabled the display of axes on the armature. Bone.002 should rotate only in its local X axis, so we can lock all IK axes except that:

enter image description here

Bone.003 has different axes, so we also want it locked in Z and Y.

And with that, we're done. You'll notice that there are basically no orientations in which these final two bones will rotate, because, coming at the end of the chain, their rotation doesn't allow any other bones to rotate differently, and because they're so much shorter than the other bones. This is the robot design problem I mentioned above. But you can rotate them a bit manually to force the IK to bend them, and they'll respect their axes:

enter image description here

This is a situation where I'd be inclined to enable rotation on the IK, except that your leg, as designed, doesn't have enough freedom of motion to meet nearly any rotation, and to compensate for that, it'd end up being a much more complicated structure than I believe you're ready for. With rotation enabled, it would be possible to leave the IK constraint on Bone.002 or place it on Bone.003, but I would probably still be placing it on Bone.002.

Edit: In comments, you've indicated that you want the foot to remain flat. This is complicated in a couple of ways, and I'd recommend getting more comfortable with regular IK before doing this, but I'll explain anyways.

To keep the foot flat, we need to control the rotation of the final bone. We can do that by enabling "rotation" on the IK constraint. When we do that, the final bone in the chain will do its best to match the rotation of the IK target. Because of that, we'll want to adjust the rotation of the IK target to match the rest position of the final bone in the chain:

enter image description here

Then, when we enable rotation on the IK constraint, the IK will try to find a solution that matches that rotation. We can leave the IK target flat, and the foot will remain flat. Or, we can rotate it, and the IK will match that rotation:

enter image description here

Notice that if the IK constraint cannot simultaneously meet the positional demands and the rotational demands, the rotational demands take precedence.

Now, here, we have another problem, which is that the leg simply doesn't have enough freedom of motion to be able to meet very many rotational demands. In particular, if I rotate that IK target in its Y axis, the IK chain just can't do that without rotating the whole chain and effectively ignoring the positional demands.

But, what we can do to address this, is add an extra, non-deforming bone in the chain, to relieve some of this pressure:

enter image description here

I duplicate Bone.002 (same location, same orientation) to a new bone I've named "Yrelax". Yrelax is parented to Bone.002.

Now, I'll put the IK constraint on Yrelax only, extend the chain length by 1, and lock Yrelax in all but its Y axis:

enter image description here

Notice how Yrelax is now rotated relative to its parent? It's taking up that rotation that your structure cannot otherwise handle. Now we can fully control the foot's rotation (leaving it flat if desired, or otherwise), without having the IK constantly freaking out because it can't solve for rotation without ignoring position.

Again, this is kind of advanced rigging work, where you want to understand base IK before you start messing with rotation+position IK, and you want to understand that before you start messing with these kind of release-valve bones.

$\endgroup$
6
  • $\begingroup$ Thank you so much for the clear and thorough explanation! The joints are working properly now. Is there any way to make the foot stay flat on the XY plane while moving and rotating the body/hub connected to the leg? The reason I added the second ankle joint was so that the body could rotate on the y-axis while keeping the foot planted. Thanks again. $\endgroup$
    – Ebchopra
    Commented Jan 7 at 17:10
  • $\begingroup$ You can enable rotation on the IK constraint to make the final bone follow the rotation of the ik target-- then, if the ik target is flat, the foot will be flat. But that's exactly why there are issues with your robot leg as designed: there is very little capacity for the foot to maintain its rotation, because the leg has no ability to twist. $\endgroup$
    – Nathan
    Commented Jan 7 at 17:16
  • $\begingroup$ @Ebchopra see edit for how to keep foot flat if you want. $\endgroup$
    – Nathan
    Commented Jan 7 at 17:41
  • $\begingroup$ Nathan, thank you so much for your help and for being patient with me. I'm obviously in over my head in this and I appreciate your support while I tried to figure this out. It works now, and I'm grateful to you for explaining it in a manner a rigging noob like me can follow. Have a great day and thank you for your assistance! $\endgroup$
    – Ebchopra
    Commented Jan 8 at 16:11
  • $\begingroup$ @Ebchopra I hope I didn't sound pretentious or patronizing or something. As a general rule, I don't recommend listening to dudes on the internet, and right now, I happen to be one of those dudes on the internet. There are a lot of bad tuts out there, a problem especially prominent when it comes to rigging, because a structure can easily work in one circumstance but not another. So, the solution to working with internet advice is to understand what they're talking about, so you can make your own judgment on whether it's good advice or not. That's why it might be better to take it slow. $\endgroup$
    – Nathan
    Commented Jan 9 at 22:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .