XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : Scripting Stretcy IK - Ran into a problem

11-05-2011, 08:59 PM
I know I'm reinventing the wheel here, but I'm practicing scripting connections (something new for me :p ) and I thought I'd script something I know how to do manually.

I've run into a snag. I don't know if this is a scripting issue or a rigging one, so I'm sorry if this is in the wrong place.

I need to know the length of the IK when it's fully extended, so I can plug that value into my Condition and MultiplyDivide nodes. The problem is, I don't want the user to have to extend the arm/leg before they run my script. I've seen scripts like this work, and they don't have to do this, so I know it's possible.

How can I determine the proper length of my IK without having to straighten my arm/leg?

Or if you know of other ways to do this, I'd love to know. I'm always up for learning new things!


11-05-2011, 11:15 PM
It's just a matter of getting the length of the two limbs (in a typical biped arm/leg anyway) and adding them together. The length will be the translate X of the child joints in each case (assuming X is the aim axis for the joints).


11-06-2011, 03:53 AM
Wow, that makes a lot of sense! Thanks so much, I think that'll work just fine.

11-06-2011, 07:10 PM
Glad that helps. I've used that method on my own rigging scripts here and it does the trick.


11-06-2011, 08:02 PM
Whoops, I ran into another problem. I'm actually embarrassed to ask this, but I'm going to anyway. :p

How do I capture the result? Say the distance between the first two locators is 25.5. Yay! Well, what do I do now? I'm sorry if that's a really basic question, but I've been looking all over and I can't find a solution.

11-12-2011, 03:37 AM
This kind of depends on the method you are using to find the distance... but assuming you are just querying a value like that, just set it to a variable.

whether you do arcLength or distanceDimensionNode (You could add the translates of the joints if you wanted to :D )
then plug x(or the value of x) into your expression for the condition.
Using the variable simply makes it so the script plugs the value in after it is found.

Assuming it is just for that reason you need the value, that should be fine.

CGTalk Moderation
11-12-2011, 03:37 AM
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.