Obviously, you are helping me so i wouldn’t expect you to leave your own things aside, take the time you need and i await your response.
I do wanna mention though that uppon playing with the arm file i sent you i figured that the first fk bone (fk_bone(0)) does copy well most of the rotations (unless you twist it in all axes) so i think it might have to do with this part of the code
Because as you can see here, the code is only giving 1 fk match bone to calculate the pole, the thing is i’m not much of a math guy so i don’t really know how to fix those calculations, but i hope that helps.
So I looked through this more closely and TBH, I don’t think this will work if the bone chain is more than 2 bones. I say this because no matter what I tried worked, but also I say this because I can’t manually pose the IK bones any closer to matching FK bones than what the script does. Try it for yourself. By moving the ‘Arm.IKController’ & ‘Pole’ bones can you get the IK chain to closely match the FK chain?
Using the file posted above, I can get the IK leg to match the FK leg by moving the IK controller bone and pole target bone
As I was looking thru your file, I noticed a few things that I changed hoping to get it to work for you. First thing I noticed once I cleared all the bones loc/rot/scale is that the FK & IK chains didn’t match:
Because that can sometimes trip up the pole calculations if the lower arm bone is rotated on more than one axis. I also tried locking down the IK lower arm bone so it could only rotate on it’s x-axis. And it still didn’t work.
That’s when I tried to manually pose the bones to get them to match.
Is there a reason why you are using a 3 bone chain for this? Over the years I’ve used this on a dozen characters and it always worked, but they all only had 2 bone chain limbs.
Yes, basically it’s because in my game characters have an specific types of legs that flex the shin, as you can see right here is suppoused to flex giving it kind of a unique movement.
Here’s the leg in the concept and how it could stretch in rig for reference:
Obviosly so far this has caused me incredible issues all around, but i tried to do it with an arm so it could be more similar to your example and i didn’t get so lost, i understand 2 bone chains is the normative but i did want to try.
Btw i did find kind of a solution yesterday but it is a bit hackish so i was waiting to see if you could find a better one, but i do understand this is a really difficult issue.
Here’s my solution anyway:
With this code you can get the ik’s to match fk’s but it takes a bunch of tries for blender to completely match the fk chain, that is why i made a for loop to run a bunch of times so it would match with just one click (this obviosly works but asks for more ram to snap all bones and makes the animation process slower).
I’m more of an artist dev so i usually don’t meddle with python this much so sorry if this is a really bad solution and it hurts to see haha, but at least it works, so if it gives you any ideas for how it could work better i would gladly update it and leave a working file to avoid more people having to deal with this.
Anyways thank you so much for the assistance, the fact that you tried all that narrows down possibilities and i hadn’t tried most of them so in the future if i update this i can narrow it down, and i understand if you don’t wanna keep looking at this because as you said it’s not much of a common issue, because people usually just use 2 bone chains.
I’ve been at it for a while so i know it’s a bit frustrating.
I’m sure there are better ways of achieving what i need but for the moment i guess i’ll keep using the system i mentioned above unless i find something better.
Thanks for explaining what you are trying to do! TBH, I was only thinking about biped characters where as what you are doing looks like a basic quadruped (dog, cat) hind leg.
I have seen this effect before, basically when the lower limb isn’t locked to rotate on only 1 axis, this would happen, the IK chain wouldn’t completely match the FK. Each time the Snap IK to FK button was hit, it would get closer to matching.
I’m going to keep looking into this and I have several ideas of how to get it to work. One method is to look at rigify’s animal rigs. The Bird, Cat, Horse, and Wolf rigs should all have 3 bone chain legs. Using rigify samples - limbs.rear_paw - gives you such a leg with FK/IK snapping.
You could just use that leg, or this option -
Also noticed my latest example is for blender 4.0. I’ll update that to 4.2 soon as well.
Oh, actually that’s a good idea, i hadn’t thought about that posibilities, i’ll check both things that you guys mentioned, hopefully something works and i can leave the other system behind and send an example file.
If you find something new while you try your new ideas, please tell me.