IK match FK?


I’m trying to match the positions of IK joints and FK ones in IK/FK switching with scripts:shrug: FK can simply done with setting the same rotation as IK joints, but I can’t figure out how to match IK ones with FK ones…anyone has done this before? please help~:scream:


I could be wrong but. I dont thinck that can happen since the joints are driven by the ik handle.


Ask eek to show u how… yesterday he showed me a sample where he switched seamlessly betwen fk and ik withno pops and such … and the ik handle maintains it offset position and no snapping when switching back to Ik.


The rig is infact now seamless in terms of keying to. So you just animate when you want, hit the fk/ik button and it switches, the blending value works and even then controls switch over.



thanks for all the replys. :slight_smile:
what i’m looking for is beyond blending…i don’t want the blend part, i want to match the position exactly where they are…


WHich they do, If I am not mistaken… and oh, hi eek…

when do u plan 2 come back?


yuliliao ,

My rig uses a blend, but as a script is turning its value on and off whilst aligning stuff the snap is instant. The animator doesnt care about the blend, he/she just hits a button, the snap happens instantly and also the blend. Literally you animate in Fk hit a button and carry on in ik, the script handles keyframe data, so you dont even have to worry about the blend. Im adding the ability to pin the rig also. So when your in IK mode you can pin the hand where it is, then turn off ik mode and go back to fk.

Its how it should be, i hate having a slider to blend between two states to many controls and things to worry about.

Hi Pappuftp,

I should hopefully come back in september hopefully if i can sort stuff out.



hi eek,

yes~ that’s close to what i’m looking for~ i hate the blend part,too.

I have a question about ur method for ik mode switching to fk part. u said u “pin” the ik and turn off the ik mode…u mean the ik will remain in that location? or it works like how u do it for fk switch to ik?

I wanna know how to write a script, that u hit it and the ik can automatically match the fk position…i have that for fk to ik now…

thanks again!:bounce:


I have a question about ur method for ik mode switching to fk part. u said u “pin” the ik and turn off the ik mode…u mean the ik will remain in that location? or it works like how u do it for fk switch to ik?

I wanna know how to write a script, that u hit it and the ik can automatically match the fk position…i have that for fk to ik now…


I basically have a script which generates 2 buttons in a rollout.

1: Is a checkbutton called “fk/ik mode” when pressed the arm goes into ik mode, when depressed goes back into fk mode. The blend and snapping is instant, and the blending values are automatically keyed for you so you dont have to worry. You just animate.


2: Is a checkbox called “pinned”. I added this as an addition as i wanted to pin/lock the hand to its location say a “wall” when i wanted. This is only avalible/active when the arm is in ik mode. When checked, the “ik/fk mode” button becomes inactive/unavalible and the arm become locked/pinned to its current postion. When unchecked the arm is unpinned/unlocked and goes back to ik mode.

The rig is very simple and nice to use. e.g

You have a guy walk up to a wall(fk mode) starts moving his hand to the wall(ik mode) and places it on the wall(pinned) and leans, then starts to take it off(unpinned/ik mode) and carries on walking(fk mode)

In fk and ik mode the arm follows with the chest. In pinned mode the arm is pinned down to it current location even if you move the chest around.

The blend for both the ik/fk mode and pinning mode, is handled in the script and keyed so you dont have to worry.

The controls also change in different states, in fk mode, you have upper arm, elbow and hands controls which are blue. In Ik mode the controls switch to green and change to one at the hand and at elbow control. In pinned mode the control switches to orange and is at the hand. You can also change the time for when different states are on and off by dragging them around in the time range.

Also by dragging the timeslider around you can see when different state are on, between fk, ik and pinned mode.

As for scripting ive just started to, so im just a beginner at Max Script and my stuffs pretty untidy. hehe

as for scripting ik snap i have an array:

–ik snap

–this is your list

posa = $fk2.pos
rota - $fk2.rotation

–then i have a list of actions

$ik3.rotation = rota
$ik3.pos = posa

You also need these to generate a key so when your in the f-curve and not in animate mode. so:

at time sliderTime animate on
$ik3.rotation = rota
at time sliderTime animate on
$ik3.pos = posa

Ive applied this to the ik swivel-angle look at, but also have a few secrets with it too.

You need to key the blend also:

st = sliderTime
pt = sliderTime-1

at time st animate on
$cb1.ikfkslider = 100
at time pt animate on
$cbt1.ikfkslider = 0

This is the same for the fk snapping script just vice versa. The sliderTime-1 is for the blend to be either on or off.

This is a little bit of the script, theres lot more. Its all going into a rig im calling “gim” and ill release it soon.



How my fk/ik button works and looks like…



Hello. Tell me if you can.

This can be made in maya?
Scripts or command… This is very intresting.

Thank you.


yes it can Pavel,

As i based my setup on the “lowman” rig which was made in maya. I added the additional pinning function as i think its really important.



wow!!! Really!!! :bounce:

Can you tell, how make it in maya? Pleese… :stuck_out_tongue:
I working now on my special rig and inserting this ability will be very useful for me.

script will be cool. :wink:


HI Pavel,

Im really a max man myself, i can use maya but not to the level of mel scripting. Im currently putting this into a custom rig myself. If i have any time ill look into mel script and see if i can write it for you, in the mean time my best bet is to look at the “lowman rig”.




no, no, I don’t want to waste your time. I understand.

Your rig is the good answear. I’ll look how it works and hope to find the key.
This will be cool staff for me.
Thanks eek. :slight_smile:


If you can write the mel script to match FK to IK, then you can easily do it in reverse. As mentioned above, FK to IK is simply matching the rotations, but IK to FK is simply matching the positions. Snap the ankle IK to the FK ankle position and snap the pole vector to the FK knee position will give you a good start. The only problem with this is if you have somthing like a reverse foot set up on the IK leg making the IK control not in the same place as the FK joints. To get around this the easy way, add a hidden locator to your FK joints in the same position as the reverse foot main control and parent this to the ankle joint. Now you can snap the reverse foot control to the same position as the locator to line it up. For things like the ball and toe rotations, it all depends on if you have rotation controls or set driven keys, but you can easily copy the ball rotations to the ball of the reverse foot.

Be careful with other types of automatic switching rigs. These sound like a great idea, but they can get confusing. If the switch from IK to FK is automatic and you don’t have a blend control, how do you change timing of the animation after you animated it? You have to have some form of blend or switch control to animate with, but that doesn’t mean you can’t automate it, just make sure the animator can over ride this automation.



I only have fk/ik/pinning in the arms. Otherwise it gets too complicate, in the legs i have a standard reverse foot , ive also added stretchability in the legs and torso. Btw i dont just match the pole vector to the elbow, i have a clever offset so the arm can break in fk mode but still work in Ik.



Thanks for all the replys~

to Ginmmel,

i haven’t thought about feet yet…just arms…thank you for making me think more~

to eek,

i just download ur scirpt and trying to figure out, thanks for sharing~


Hey All,
Great topic here. If someone is interested in some code sipnet for a IKFK match mel script then here you go.

The idea is to have three arm. The real one which is the one that blends from Ik to FK. The Ik arm and the FK arm.
Here is some basic code that would get the values.
float $IKShoulderX = getAttr IKshoulder.rotateX;
float $IKShoulderY = getAttr IKshoulder.rotateY;
float $IKShoulderZ = getAttr IKshoulder.rotateZ;
// Same for the IKelbow
setAttr FKShoulder.rotateX $IKShoulderX;
setAttr FKShoulder.rotateY $IKShoulderY;
setAttr FKShoulder.rotateZ $FKShoulderZ;

Place the code in a button for Match FK to IK
It’s quick and dirty but the general idea is there.
Hope this helpful to someone


If you have something like an IK arm where you’re using a pole vector contraint and the twist attribute of the IK, this would be the easiest way to do it. I’ll assume you’re controls pivot point is on the wrist, as well as the IK handel, and the Ik handel is parented under the control. I usualy constrain locators to the wrsit and elbow of the FK arm. Then I can make a script that moves the arm control to the locator on the wrist and the elbow control (polve verctor control) to the elbow. If you’re using the Twist attribute as well (yeah i know it’s redundant, but some animators like it) you have to account for it and zero it out.

It’d be pretty close to the script setup that NolanSW posted.