# Stretchy Ik on/off using constraints?

#1

I’m new to this site so hello, I’m self teaching myself how to rig and i was recently learning about making a stretchy joint chain. but i’m not to familiar with using nodes or mel so i though about using constraints. I wrote this jargon down to remember what i did so any feedback would be greatly appreciated.

Stretchy Joint chain using contraints???

create joint chain
ex//

Arm/elbow/wrist

create ik

Go to create/measuring tools/distane

then (holding v key) select the “arm” joint and “wrist” joint

parent locator to “wrist” joint

select ik handle and move until joint chain is completely
straight.

write down distance given

then go to window/animation editors/expression editor

name your expression (Example Stretchy joint chain)

enter expression: (This expression was provided from the book
“The Art of rigging”
which is an amazing book that is
uber helpful!! Numbers given are for example purposes)

if (distanceDimensionShape1.distance >= 12.9 )

{
//Stretch!
arm.scaleX = (distanceDimensionShape1.distance / 12.9) ;
elbow.scaleX = (distanceDimensionShape1.distance / 12.9) ;

} else
{
//Do not Stretch
arm.scaleX = 1 ;
elbow.scaleX = 1 ;

ex// forearm.scalex = (distanceDimensionShape1.distance / 12.9);

If there are no errors then move joint chain and joints should stretch
the wrist won’t stretch unless you specify otherwise.
reason why the scale is set to X is because that is the axis that
,by default, follows the joint chain.

I realized theres no real way to turn the stretch on and off
without knowing some kind of expression or something so i
figured constraints could work. This is what I came up with

bring ik handle to original location

create a control curve/object, give it a name ex//Ik Wrist cntrl

In the channel box, add a float attribute named ex//IK Stretch
minimum 0 max 1 default 0
and point constrain the distance end locator to the curve/object.

create another locator and v snap it to the distance start
locator, give it a name ex// distance helper

Freeze transformations

Point constrain the “distance helper” to the " IK Wrist cntrl"

in outliner or hypergraph, select the distance end’s point
constraint. This should have two values just below the offset.
ex//
Distance Helper1W0 = 1
Wrist CNTRL1W1 = 1

go to window/animation editors/set driven key/set

select the “wrist cntrl” as the driver and the point constraint
as the driven. change the value of the “wrist cntrl” ikstretch
to 0

select the point constraint then theand the distance helper to 0 leaving the wrist cntrls value
at 1.

select the point constraint then the Distance Helper1W0 = 1
Wrist CNTRL1W1 = 1

change the distance helper to weight to 0 leave the wrist cntrl’s
weight at 1

in the driver window select the controller, then the attribute
in the driven window select the point constraint and the values

press key, select the controller in the
driver window, change the attribute to 1

select the point constraint in the driven window and change the
Distance Helper1W0 =1 Wrist CNTRL1W1 = 0 and then press key.

this should have created the setup for an on and off switch for
the stretching of the joint chain.

like i said, i figured this out through trying to think of the
best way to do this kind of a setup through simple weighting of
constraints. Kind of like how you would do a ik/fk setup using
3 joint chains. I just wanted to make sure that this process would
be ok if i were to add this to a rig and then animate with said rig
any criticism or additional input is greatly appreciated.

#2

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.