# How can I limit the rotation of a bone using euler angles in ik

The problem is I'm trying to limit the y rotation of the top bone in an ik chain to 0.

By the way, I'm not using a pole target.

When I posed ik handler, then applied the visual transform to the bone, I noticed the y rotation of the bone ignored the constraint.

As you can see in the picture below ik constraint tab is doing nothing.

Now, here come the weird part, I noticed that if I change the rotation mode to quaternion, the bone y component is always 0, as you can in the picture below.

The problem is I need the bones to rotate in the yzx axes

You can replicate this fairly easily, just create 4 bones, change the rotation mode to yzx, remove the parent from the last bone and make it the ik handler, no pull target.

So I have two questions:

Does the ik rotation constraints only work in quaternion ?

How can I limit the y rotation to 0 while using the yzx rotation mode while using ik ?

I also tried all the other Euler Modes, the problem is still there

I gave a poor answer earlier. I was thinking of a different situation. I apologize.

But the main issue here, with the precise locks and limits you're using, is that 3D angles aren't decomposable into 3 independent axes.

The easiest example of this is to consider two different XYZ Euler triplets: either rotate in x by 180 degrees; or rotate in Y then Z 180 degrees each. This is the exact same orientation. So when we look at this orientation, does it have Y axis rotation? When we lock an IK bone in Y, should this be an orientation it should be able to reach?

Let's do an experiment. Just take one bone, make it any kind of Euler we want, and then rotate it in only local X and Z axes. For ZX Eulers, rotating it in X then Z will give us Y axis rotation; for XZ Eulers, rotating it in Z then X will give us Y axis rotation. Even though we never rotated it in Y! So do those orientations have Y axis rotation? Are these orientations that a Y-locked IK bone should reach? No matter what the orientation, our Y locked IK bone is going to have Y axis rotation when it rotates in both X and Z, because the Y is not independent of X and Z.

Let's do another experiment. Let's make a Y locked IK bone, a bone that locked tracks X then Z the target, a bone that locked tracks Z then X the target, and a bone that damped tracks the target, and rather than looking at their Y channel values in some particular Euler order, let's look at what direction their axes are pointing:

We can only see three bones there-- that's because the Y-locked IK bone has the exact same orientation as the damped tracking bone. Meanwhile, the two locked track bones' axes point completely different directions. The IK bone and the damped track bones' "roll" are in the middle of our two locked track orientations. That's how a Y-only locked IK bone acts; and this is indeed the smartest way it could act. The concept of bone twist is not as intuitive as it first seems, because it is not independent of other rotation, but this is the closest we can get to the idea of no-twist.

Now, what you're showing here is an upper arm, with an upper arm twist bone, and an IK forearm, presumably with a 3-bone chain length. There is likely one of two practical questions here that you want answered:

1. How to keep the upper arm from adopting ugly positions? The answer is not through IK angle limits, but through restraining yourself from placing the IK target in places that will lead to ugly positions. There are places where an arm cannot reach. Don't put the IK target there. Trying to enforce arm position via IK angle limits will lead to twitch if it ever comes into play. A good upper + lower arm IK system has 1 and only 1 solution for any position of the IK target (within reach), which is exactly what you want for IK, and all angle limits can do is make situations where there is no solution, so the bones will do something weird.

2. How to make a automatic twist bone setup for IK? Start with a two-bone IK arm (upper arm, forearm) without any angle limits on any bone, with the forearm slightly, naturally bent. Disable deform on the upper arm bone. Create a new upper arm, parented to shoulder, and damped track the tail of the IK upper arm. Create an upper arm twist bone and parent it to the IK upper arm:

• thanks once again for taking the time to answer .first, i had like to clarify the problem exist even by slightly moving the ik ,i'm not moving the ik in an extreme position .what you mentioned make sense but the point is when animating ,the Y rotation should stay at 0 ,even if X and Z both rotate,just like in FK .also i'm using a daz model , that means first i cannot add new deform bones ,delete or change existent ones, second ,the upper arm and upper leg both are locked on the Y axis ,since there is a twist child bone for that ,i found a work around ,will write it in a bit ,thanks once again Jan 31 at 0:34
• It doesn't matter how far you move the IK. This will always be true. It is not something that only occurs at certain angles; the 180 degree example is merely the easiest to visualize in your mind. The example with four bones involves a rotation of less than 90 degrees from rest as demonstrated in the picture. Jan 31 at 0:58
• i did not say you are wrong or that i did not understand ,it's simply beyond the point ,when baking the constraint later on for the animation ,the Y rotation should be always 0 in the graph editor ,its literally unacceptable for Y rotation to change from 0 since the bone have clear limits it should not exceed .so when i apply visual transform ,if the Y is anything other than 0 ,or if the X and Z went beyond the limits i set it's a failure Jan 31 at 1:11

I fixed the problem using rotation copy constraint

I duplicated the the bones needed for the ik chain, in this case, made a copy of, upper arm bend, upper arm twist, forearm bend, forearm twist, fixed their hierarchy, created the ik chain from the copied bones, made forearm bend and forearm twist copy the rotation each from its own duplicate, made the upper arm bend copy only the X and Z of its duplicate and finally, made the upper arm twist copy the rotation from its duplicate and the Y rotation of upper arm bend

EDIT : or a simpler way would be to make a two bones ik chain 'upper arm' and 'forearm' ,make the two FK bend bones copy the X and Z ,and the two FK twist bone copy the Y

The rotation copy constraint should be in local space.

If the bones are not moving naturally or look too stiff, play around with the stiffness value of rotation in the inverse kinematic tab for each bones.

Make sure to untick the deform option for the duplicate bones and to tick Only Deform Bones in the export options if you want to export the animation.