Two Bone Ik is twisting the middle joint

I’m working on a VR project and so I’m using the two bone ik node to solve for the player character’s arms. The problem is that the IK isn’t solving like I would expect for the middle joint in the chain. Even though it looks ok at first, I noticed that the elbow is sort of spinning around, instead of behaving like a hinge joint where it only bends in one axis. I have a series of corrective joints that require that the elbow only bend in that one axis.

At first I thought that unchecking the “Allow Twist” checkbox on the ik node would fix this, but it didn’t seem to do anything. Is there a way to get the elbow to behave like a hinge joint with two bone ik?

I’m using UE version 4.25 thanks!

It’s usually due to a bad procedural placement of the pole vector.
I actually have the same problem happening on DynoFoliage but never bothered patching it since it’s not really within the scope of the project.

To fix it, you would have to calculate the proper position of the pole that determines the rotation.

oh. Well, obviously, switch to ccik or Fabrik first.
​​​​
2boneik is really just for weapons. The same theory applies though. Each weapon potentially requiring the joint to be at a different spot.

One way to solve the issue is to have the elbow joint driven by the hand orientation.
In order to do this, you can use a scene component attached to the hand joint, but with a location offset to get close to the elbow joint, but be sure to be “a bit behind” the elbow joint to avoid flips.
Then use the location of that scene component as the pole vector in your two bone IK.
Allows twist, if I remember correctly, needs to be checked, otherwise the pole vector will rotate on itself like crazy, even though you won’t see the rotation because you’re using only location.

If you also want to drive the clavicle orientation, use CCDIK with from clavicle to hand, then chain the two bone IK node, and there you go :wink:

Thanks for answering! So I was wondering what you meant by driving elbow orientation by the hand orientation? Right now the pole vector seems fine in terms of the elbow’s position. I’m not seeing the typical error of what it looks like when a polevector is badly placed, where it will cause the arm to flip out. The problem that I’m seeing is the elbow joint seems to not be “hinging” in one axis. I only noticed it once I started adding the helper joint for fixing elbow deformation (a joint that is parented to the elbow that will make the elbow look pointy by translating outward as the elbow bends). But that won’t work if the elbow is slowly spinning as it bends because the pointy part of the elbow will become the top as the elbow spins.

Is there some way to fix this problem by using the hand orientation?

potentially, you could derive partial rotation of the elbow pointiness by the dot product (ratio) between the rotation of the hand and the lower hand?
the more the hand twists, the more the elbow is pointy?

Personally, instead of using bones I would just use a morph on the elbow joint that automatically drives itself based on the curve between the lowerarm_l/r and upperarm_l/r

Sort of less stuff to worry about when you set it up once within the BP or a post process abp.
If you want fastpath all the way, just use a curve value not calculated in an animationbp (do the math on character) every frame.

Anyway, a video to show us what you mean by “hinging” not the right way would be kinda awesome. you definitely lost me there.

Thanks again for answering! Yeah doing morph targets would be nice, but I’m sort of forced into using bones because I’m going to be rigging tons of characters using this skeleton and being able to transfer the skinweights instead of making morph targets for every mesh is more desirable.

To illustrate my problem, you can see how the arm “hinges” on the Y axis of the elbow in the image that I’ve attached. So it should only bend in the y axis when it has IK on it. The other rotation values should stay at zero because an arm only bends along that axis. You can see proko talk about the hinge joint in this youtube video at around 1:45.

So when I go into unreal and print the local rotation values of the elbow while I’m previewing, I am seeing rotation values in all three axis change as I bend the elbow, where I would only want to see values in one change. In addition to that whenever I draw debug coordinate system on the elbow, I can see the axis of the elbow rotating in ways I wouldn’t predict. Like it is spinning around in the X axis as it bends. I would make a video of this, but I’m under an NDA and it would get me in trouble. Thanks for your help!

He, well, if You want it to work that way, sure.
Set up a PHAT asset or pick the default mannequin. click the arm joint. disable Gravity. and instead of play hit the Simulate all bodies below option.
After you are done you can probably review the constraint settings to see how much of a swing it has vs how much twist is allowed (if any).

Twist on lower arm comes from clavicle IRL, so sure it’s “only on y axis” since to get rotation of it you have to twist upper arm.
At the same time, you also do have twist on lower arm. or your hand won’t rotate - etc.

Must have to do with the node setup.
You can share a screenshot of the details panel of that without breaking NDAs right?