CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 07-24-2013, 08:52 PM   #1
Jack of All Trades
Malkalypse's Avatar
Kevin Mackey
Arlington Hts, USA
Join Date: Nov 2005
Posts: 1,302
Send a message via MSN to Malkalypse
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??
Old 07-25-2013, 09:52 AM   #2
Join Date: Mar 2012
Posts: 123
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.
Old 07-25-2013, 04:58 PM   #3
Jack of All Trades
Malkalypse's Avatar
Kevin Mackey
Arlington Hts, USA
Join Date: Nov 2005
Posts: 1,302
Send a message via MSN to Malkalypse
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...
Old 07-25-2013, 04:58 PM   #4
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,479
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 11:42 PM.

Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.