View Full Version : Stretchy IK Switch
DanHaffner 05-16-2009, 08:55 PM I am trying to create a switch that will allow the animator to either turn on or off the stretchy IK system. The way I created my stretch was the distance method, taking the distance, dividing it by the original distance, and then using the new number to scale the joints, along with a condition node so it knows if it needs to stretch or bend.
I know how I could very easily script this and have the switch control if the output of ColorR on the condition node is hooked up to the scale of the joints or not, but you can't do an if statement like that in the expression editor as there is no way to tell it when it needs to run.
I know there are other ways of doing a stretchy IK system, but does anyone have a mothed for turning it on and off?
|
|
Karnageddon
05-16-2009, 09:13 PM
Is it possible to post the scene, or a quick mock-up of the scene? I was struggling with on/off switches for the last few weeks and very recently got it working. I can take a look into it for you.
DanHaffner
05-16-2009, 09:32 PM
Sure.
http://www.mediafire.com/download.php?0znxynwjimz
Leffler
05-16-2009, 09:42 PM
Its just your connections that are a bit off.
Instead of connecting the distance to the conditionnodes first term, add an attribute to the ik controller called stretching or something like that, a boolean.
Then connect that to the first term. Set second term to 1 and operation to equals
Now, it will output the distance if the attribute is 1, otherwise it will give 1 if thats the default
Makes sense?
I can send you the file otherwise
// Otto
DanHaffner
05-17-2009, 12:02 AM
That works, but how do I get it while it's turned on, to bend when the IK handle comes close to the body?
trevorsommer
05-17-2009, 01:11 AM
The easiest way I have found to do this is to use the color blend node, put the output from your current stretchy setup into the input for color1r, then set the color2r to 1. Create an attribute on the controller to drive the blender attribute on the blend node between 0-1. this should give you a nice smooth blend between stretchy and non stretchy joint chains. then just connect the output from the blend node into the scaleX of your joints.
I am telling you how to do this off the top of my head so there might be a little more to it then this but it should give you the idea.
DanHaffner
05-17-2009, 01:29 AM
Thanks, I'll head down that road and see where it takes me.
Leffler
05-17-2009, 09:46 AM
The easiest and fastest way is just set the minumun scale on the joint to 1 .... then it will bend
//Otto
DanHaffner
05-17-2009, 05:29 PM
Hahah! I didn't even think of that. Worked perfectly. Thanks for pointing out the obvious for the slow folks like me.
CGTalk Moderation
05-17-2009, 05:30 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-2012, Jelsoft Enterprises Ltd.