View Full Version : Neck IK Spline swit to FK
02-08-2009, 05:59 PM
I have a Neck(from a deer) with an IK Spline and i want to switch between the IK and FK, but whenever i do this, the position of the joints get diferent from the IK to the FK.
Imagine with the IK i have the neck turned to the rigth and then i switch to the FK the joints are going to adjust to another xzy rotation, for example 0, 0, 0, if before i havent moved them wit the FK system, and it would happen the same the opposite, between FK and IK.
I'm using the main rig of the Neck wich has the IK Spline (with clusters attached to the curve). Then another rig duplicated just from the Neck, to wich i parent constraint the clusters; then i have control curves parented to this duplicated rig.
For the FK i just have control curves attached to the neck that are activated with a switcher that turns off the IK Spline (the blend to 0) and the weigth of the parent constraints from the clusters to 0.
The way i switch between the IK and FK is controling their Weigths between 1 and 0.
Should i use a script to "save" the xyz and then connect it between IK and FK?
You can find a file attached with the example of what i'm doing.
Thank's a lot!
02-09-2009, 02:28 PM
You might want to include a ".ma" file instead of a ".mb" because a lot of people will have earlier versions of maya that won't open the 2009 file.
I can't quite tell until I get the file, but it sounds like you're mainly getting problems because the Clusters are still affecting the joint chain. If I'm reading it correctly, you only have 2 joint chains? You can always do 3 joint chains (an IK, an FK, and a Bind) and switch between those like you would for a standard arm IK/FK switch.
Post the .ma and you'll be able to get more help.
02-09-2009, 03:21 PM
Thanks a lot for your reply.
Actually i have more then two joint chains, i have 4 chains, although i recognize that it would work probaly just with 3 chains.
The Joint Chains i have:
a)Main Skeleton chain
b)Neck Fk Chain - Chain to wich i connect control curves wich control each joint
c)Neck IK Chain - each joint is connected to the cluster and to this joint chain i have
control curves controling the IK
d)Neck IK Guide - Wich as the IK Spline with the clusters
Then i connected the Neck fk chain and ik chain to the Main Skeleton.
If on the hypergraph you select my cc_Switch and check the input/output you can see i connected the parent contrain nodes with the switch so that i can control when the ik or fk is on or off.
Someone told me this could also be done switching Ik Blend channel of the IK Spline Node, even if i do that i still won't be able to make the IK joints acquire the position of the FK and the other way around.
Once again thanks for the help, this is making my brain melting for the last days, and for sure it's just something simple to make it work properly :)
You can find the .ma attached.
02-10-2009, 04:32 PM
Any idea guys, of how i can solve this problem?
02-10-2009, 09:32 PM
Ah, you're wanting to do some IK/FK matching.
Matching the FK to the IK will be easier. You can record the xyz rotations of each joint and copy those over to the corresponding FK controls (assuming that your FK controls have the same orientation as the joints).
The IK will be a little more difficult because it is an IK Spline instead of a regular IK handle. First of all, in the file that I opened you only have 2 controls (none of which are at the end of the joint chain near the head which I find a little strange). I guess that you could create 2 more controls and place them on the joints in the same place as the other 2 FK controls. You will then need to grab the information that contains the position of the FK controls. The easiest way to do this will be through scripting using "xform" to store the world space coordinates of the FK Controllers. Because it's an IK Spline, however, I can't guarantee that the joint will end up in exactly the same place because there are 6 Clusters and only 4 FK controls to grab Data From. If you were to re-create the IK Spline with only 4 Clusters placed exactly on the joints then it would work very well.
Something that you might find even easier would be to integrate FK controls into your IK Spline Setup. The FK Controls would drive the IK Controls, and the IK Controls move around the Clusters. That way you can have the freedom to do both IK & FK without a switch. Is there anything in your project that would keep you from doing that?
I disagree with your friend about just turning off the IK. When you do that you run the risk of positions not transfering over correctly and getting weird positional nodes.
02-11-2009, 10:20 PM
That really helped!! thanks
First of all i tryed the scripting with the "xform". I managed to find good information how to do it here http://forums.cgsociety.org/archive/index.php/t-316119.html although this is the first time i'm scripting, so i did something like:
This one is for the IK -> FK, i guess that from FK -> IK if i have the rigth number of clusters there will be no problem. When i made run the script the position of the joints aren't perfectly but it's not a big issue, it must be from the number of clusters, or something like this.
global proc switchikfk( )
float $ccNeckfk11 = `xform -q -ro cc_Neck_FK_11`;
rotate -os $ccNeckfk11 $ccNeckfk11 $ccNeckfk11 cc_Neck_IK_12;
Now the other solution you presented is being more tricky to get it working:
"integrate FK controls into your IK Spline Setup. The FK Controls would drive the IK Controls, and the IK Controls move around the Clusters. That way you can have the freedom to do both IK & FK without a switch."
I Managed to get the IK being driven by FK. The only problem is that whenever i'm moving the joints in the FK, then moving the IK when i want to go back to the FK the IK just switch from where they were to the FK position.
For example i move the base joints with the FK Control Curve, then i move the last joint with the IK Control Curve, then if i move the joint after the Base with the FK Control Curve, the all chain of IK just switch to the position of the FK.
I will attach a file showing how i applyed the solution you gave me :)
I think i'm gonna manage to solve the initial problem with the script :p
Thanks a lot for the help,
02-12-2009, 04:31 PM
Well, your problem is that you still think you need a switch.
The point of integrating FK controls into your IK rig is to eliminate any need for Switching whatsoever. You're overcomplicating the process. If you've properly incorporated FK controls into the IK setup, then you can delete the FK Joint chain & its controllers altogether. Note that the keyword of the last sentence was "properly" incorporated.
If you can get your hands on the "Art of Rigging Vol. 1" then it would be much easier to show you what I mean.
The script looks correct at a first glance, but I'll need to play around with your scene file to understand for sure.
02-12-2009, 04:31 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.