How can I fix the rotation on the legs?

fellow blender artists!

What you see here is work in progress, for an ad I'm working on, with CGI involved. I'm posting this as I will need some help and feedback from you guys.

Alright so let's get to it. These legs have to be animated so that they're fully functioning, and for that reason I have set up bones with IK constraints, and to some extent it currently works, however, with some issues involved.

So here you can see the bones, every bone starting from the centre of the coffee pod, who I'll call Jimmy for my own amusement. The first bones of every leg (The ones inside Jimmy) are out of the IK chain, while the IK controllers are the last, small bones facing downwards.

Problem 1 - Clipping

Alright, so in this image you can see how the joint (actually attached joined with the first part of the leg) and the first part of the leg clip into one another.

This seems to be, or at least from my understanding, a child problem of

Problem 2 - Bone Rotation

In the way I have engineered these legs, each one of the parts basically would have to rotate up and down, with a very minimal movement to the sides, maybe only from the top part. (I am still unsure which option would be best here, or even if to re-engineer the first part so that it can rotate sideways) However, what happens in reality is that the bones rotate sideways as well, over the Z-axis, from what my understanding is. So what I have tried to do is to restrict that movement by using the "Lock IK" option, "Stiffness" and the "Limit Rotation Constraint" from the Bone Constraints tab, and limiting the different axis's to 0, or basically trying different combinations, but I can't seem to work it out.

This problem leaves us with two sub issues, one I've already shared with you, Clipping, and the other:

We get movements like these, when trying to animate a walk cycle, for example.

Another thing that has been helpful to some extent, is the Pole Target option, as I have noticed that it can add some additional stiffness to my bone rotation. The problem here is, that this is not a human elbow, or knee. Hence, sometimes I'll need the middle part to rotate upwards, and sometimes downwards.

Also, I am not sure about this, but does blender disregard the limit rotation constraints when there is a pole target active? There seems to be something happening there.

Anyways, I think this is what is preventing me from moving forwards at the moment, I hope you guys can help me out here and give me some feedback! I'm open to ideas non-related to these issues as well, so feel free to shoot. Thanks in advance! P.S. Jimmy is thankful as well.

• If you're just looking for a walking mechanical spider creature with animation, see this detailed Polyfjord tutorial which should give you some ideas. Commented Dec 10, 2023 at 15:47
• @JohnEason I have watched some of his stuff, he indeed has amazing tutorials! However, that isn't going to be helpful in my case. Thanks anyways. Commented Dec 10, 2023 at 16:28
• since we have no idea how you did it, we can only advise you to watch some beginner rigging tutorials. Or...you provide your blend file so we can tell you exactly what you did wrong. thx. Generally speaking it's a pretty basic rig you have there. All you have to do is lock the right axes and do the right settings in the rig. Commented Dec 10, 2023 at 17:38
• You want IK locks and only them-- can't tell you why they didn't work for you in your first attempt, not without file. Yes, pole Ts override on the first bone; so don't use pole Ts, or don't move targets to a place that will give you a wrong solution. Don't combine other constraints, like "limit rotation" with IK control, it probably won't work like you expect. If you need a bone to bend through the straight, you will need to do that manually and to time it carefully. Also: recommend aiming for one question per post. Commented Dec 10, 2023 at 17:58
• @Chris Hey there! Here's the blend file! I'll be more than thankful if you can take a look :) we.tl/t-Chpe7YEyvD Commented Dec 10, 2023 at 17:59

When we put the armature of one leg into rest position and look at its axes, we see that its axes are not aligned with the desired rotation of the bone. This is easiest to see when using an octohedral display with axes enabled (which I recommend using while rigging. Other views obscure information that the rigger needs; think of them as being views that the animator wants, not the rigger.)

We want to use IK axis locks, but there is no single bone axis that corresponds to the axis in which we want to allow rotation.

Unfortunately, the meshes are bone parented rather than bone (relative) parented, so we have to unparent them if we want to change the bone's rest axes. So, first, unparent the mesh objects with keep transform, then reparent to the bone with bone(relative). I'll do this with a single mesh object.

To get the right axis, I'll adopt the view of a mesh face (with a face in mesh edit mode selected, ctrl shift numpad 7 for me), then use a recalculate roll operation:

Now I can set appropriate IK axis locks for the bone. The bone should be allowed to rotate in its (new) Z axis but in no other, so we'll lock X and Y axes, then set the armature back to posed position to check:

I've only done one bone, but we can see that it's no longer rotating wonky to solve the IK.

• Thank you for your help! I will try and follow up with these steps and see if I am able to work it out. I can’t express enough how happy I am that you exist. Will keep you in touch! As long as that is alright:) Commented Dec 10, 2023 at 18:35
• your answer was indeed correct, I did not realise that the local axes of the bones were all messed up, since I had it all in stick mode. Now I just need to figure out how to stop the bones from glitching, as they don't know in which direction to bend, and a pole target messes things up. Thank you once more! Commented Dec 10, 2023 at 19:53
• I would expect the answer to be, don't use a pole target. They are optional and they don't do what most beginners expect-- they won't rotate your bone through the straight line (except in very special circumstances, circumstances which should be avoided anyways.) To rotate your bone through the straight line to the other angle, pose some rotation, which gets evaluated prior to the IK in order to determine the way that the IK bends the bone. Commented Dec 10, 2023 at 20:09
• Will try and see if I can make it happen, right now it's just jumping from one rotation to the other. Thank you so much! Commented Dec 10, 2023 at 20:19
• Considering that it's a different question, you should ask in a different post, and provide a file showing what you've done so far (including keyframes to demonstrate the discontinuity.) That's what I'd recommend. Commented Dec 10, 2023 at 21:54