Need some clarification on IK things

Gotta make sure to have


Load Unity Toolkit checked.

So as far as I understand IK stuff to work I thought the pole target is supposed to be in the direction the elbow/leg is supposed to bend.

So for an arm it would be behind the elbow, and for a leg it would be in front of the knee.

I can not for the life of me get these arms to act natural. In order to get them to bend the correct way I have to set the pole angle to Math.PI * 0.5, but that then makes the hand face outwards instead of its natural position.

What am I doing wrong here? I can never get the IK stuff to behave in BJS, but am able to in c4d and blender so I’m not sure where the disconnect is.

I added some “Spine Bounce”, and it seems a little more natural (ha)… but still need some ideas on how to control this better and get it looking like dude is holding on the reins.

Once we can figure that out, ill move on to the legs.

I get this error in the playground’s console and in the sandbox:

Everything I can see is the ground mesh.

the first post has why, you need to make sure the Unity Toolkit is loaded.

cc @PatrickRyan might have some good ideas?

I just need more explanations on how the stuff all works, and maybe some clarification on how to visualize the pole angle and bend axis so I can debug a setup better.

My head is not really in IK now, but here are things which I do differently, for what it is worth.

  • I don’t use poleTargetMesh. I use poleTargetBone. The bone used is 2bones up. If forearm is the control bone. PoleTargetBone is shoulder. poleTargetMesh is just one more thing to deal with. The bone is already there.
  • Am hard coding BABYLON.Vector3.Left() for bend axis, always
  • I only establish one pole angle, & setting the other side to Math.PI - original or -Math.PI - original.
  • I do not use GLB, but computer generated source code for the skeleton / mesh(es).

How I established the pole angle was by turning the thing on & trying to keep the skeleton from moving from the rest position with the settings made. When it did not jerk, that was the value.

3 Likes

Can you think of a way to visualize it? Like if I was to draw a line debug system for all this how would you go about that?

Not right now. Did just check at what gets stored for an IK pose.

  • Target position.
  • Target rotation, which also gets used in my BABYLON.BoneIKController sub-class to control the bone after the control bone, wrist.
  • Pole angle, so the angle I described before must be just for initializing. I am initializing both sides though, and there is a relationship.

That’s all I got. This not what I am currently doing.