Notifications
Clear all

[Closed] How does the IK/FK Snap button actually work??

So a while back I came up with some ways to simulate the effects of the “IK/FK Snap” button for IK controls, basically using the following concepts:

To go from IK to FK is simple: just store the transforms of the objects in the chain from base to tip, switch the enabled state to 0, and set the objects to match the stored transforms (starting at the base and working toward the tip).

To go from FK to IK basically comes down to having a dummy object to match the IK control position to, and using a swivel target to control the angle of the limb. Again fairly simple… as long as you have a chain with a single joint!

Here’s a simple chain with 3 segments and a tip. In the first panel, the IK control object’s enabled state is 0. If I set the enabled state to 1 via Maxscript (or click the “enabled” checkbutton with “auto snap” unchecked), then I get the second panel. If I first click “ik/fk snap” then do either, the IK enabled state switches to 1, but the bones remain in place.

My solution for 2-segment IK chains does not work. The IK control and swivel target positions are exactly where they should be, but with more than 2 segments, that is not enough to match the bones to their FK state transforms.

The macro recorder shows

IKChainControl.IKChainActions.snap ()

which works in a script if the IK control object in question is selected. And that seems to be the only part that’s necessary; the macro recorder also shows all the preferred rotations within the chain, but whether those values are set or not appears to have no effect on anything.

Unfortunately, I’ve been totally unable to figure out what the snap button/action is actually DOING. I can’t find any values anywhere that it actually seems to be changing, beyond the actual transformations of the objects in the IK chain (which, with the chain in an IK state, I cannot find any other way to set directly…)

I suppose if I absolutely have to I can always have my script automatically select the IK control object in question and run “IKChainControl.IKChainActions.snap ()”, but there HAS to be a better way, doesn’t there??

2 Replies

You can get the swivel handle target position using t he bone’s position and then gets virtual plane normal between between them. Then all you need to o is to place the target at the right place.

That works for 2 segment joints. Unfortunately, as you can see in the images, I have the swivel target on the plane, and it still doesn’t work. Once you have two or more joints, there can be any combination of rotations that still point out toward the target.

I’m currently using a workaround solution that basically follows the format of

  1. store selection
  2. select IK object
  3. run IKChainControl.IKChainActions.snap()
  4. select stored selection
  5. change IK state

It works, and actually doesn’t cause any noticeable delay in performance. If this is the only way to do it, then I guess that’s fine…