IK Stretch

Is there any documentation on the IK constraint other than this wiki page?

In the leg rig I’m working on, I’ve got a chain of deforming stretch bones copying the rotation of an identical (non-deforming) IK chain, and sometimes the rotations mysteriously don’t match up when IK (which has the Stretch button on) is active without the ‘Stretch To’ constraints also being active. When both the ‘Stretch To’ and ‘IK’ constraints are on (Stretchy IK mode), there’s no problem!

Maybe it’d be fixed with a second set of IK constraints on the IK chain – two IK constraints per bone, one with Stretch on and one without, alternating with the ‘Stretchy Leg’ switch – but this seems sort of dangerous, and would probably be troublesome for keying space switching.

Has anyone else come across this, trying to build an FK/IK/StretchIK limb?

(I’m going to build a simple example blend, but am hoping someone else has come across this and solved it.)

Well first of, I’m interested in this space switching thing, please post the blend!

StretchTo is probably ‘correcting’ existing rotation constraints. Are the orientations correctly set? I believe the conventional approach doesn’t even apply StretchTo onto the deforming bones. The BBB rigs use a copyrot, copyscale and a preserve volume.

Although I’d have to take
a look at the .blend.

I too would be interested in seeing a demo file of your setup :slight_smile:

I may then be able to make suggestions…

I’m mainly cribbing cesio’s Max rig, modified for FK and non-stretch IK. (I want to eventually use Kiopaa’s script, too).

Layer 1: Root
Layer 2: FK Controls, FK Chain
Layer 3: IK Controls
Layer 4: IK Chain

The upper switch is FK/IK, and the lower is Stretch OFF/ON. Try switching into IK and leaving Stretch OFF, and translating the root downward – the foot dips below it’s rest position. Then zero everything out and switch into IK with Stretch ON, and the foot stays still. It’s screwing up without stretch, but works perfectly with it enabled.

The only thing I can figure is that it has to do with the IK Constraint’s ‘Stretch,’ because setting the ‘Stretch’ number higher in the ‘Armature Bones’ panel (like changing it from .010 to .5) on the IK chain’s bones causes the foot to dip further. Setting it to zero screws up the knee, causing only the shin to stretch, and setting uneven numbers among the bones in the chain positions the knee off center.

I thought of parenting the knee to a large stretch bone from hip to ankle just to keep it at center, but it prevents the knee from following the leg correctly. A floating helper bone, parented to the shin instead of the knee, for the knee to ‘Copy Loc’ or ‘Child Of’ will probably cause a dependency cycle. Turning the stretch bone in the opposite direction, so it stretches upward from the IK foot to the knee like in MCHammond’s rig made setting up all three modes troublesome in an earlier attempt (probably my error), but looking at it now it might work. Would have to add another chain or two to compensate, though, which I was trying to avoid.

Any help’s very much appreciated!

Attachments

stretch_problem.blend (173 KB)

Very cool setup, I like where this is going! :slight_smile:

The problem is because when the stretch is off, the IK chain (which determines the motion) is still stretching, since you’ve enabled the stretch in the IK solver. If you turn off the stretch of the IK solver, you’ll see it works fine with IK on and stretch off.

Basically you need to find a way to either correct for the distortion, or set it up so that when the stretch of the leg bones are off, the stretch of the IK chain is off as well. Maybe instead of using the stretch on the IK itself, you could create a separate chain for just the stretchiness? I’m sure you can figure something out :yes:

Looking at it really closely, I see the foot bone dips down even with stretch ON, by a minuscule amount. I guess I might have to start over with more chains (yuck). The ‘switch dependent switch’ will come in handy, anyway.

I’ve checked some of the public rigs available, but have probably missed some; plenty have IK/FK and stretch, but do any have limb stretch than can be disabled like this?

The white nelb rig re-make by FreakyDude has a stretchy mechanism that seems similar to what you are trying to do here I believe…

I think a good way to tackle this problem (as Freaky did) is to use free-floating bones for the deformations… so the stretchiness is done by just dragging those bones wherever you want them. That way you don’t have the propagated scale issue from a connected heirarchy (parent deformations continue down through the children, which is the essence of your problem here).

You may also want to take a look at the stretchy suzanne rig I made, since it uses disconnected bones to deform the mesh as well (on layer 16). It’s not on/off using a switch, but instead the stretchy controls are just parented onto a set of non-stretchy bones. It’s not ideal, since it is hard to make the character walk when the legs are stretched out, since they are pulled away from the bones in a ‘freeform’ kind of way and move along with the base skeleton… but it could give you further ideas, it was a very experimental rig.

I am not aware of any other rigs that allow the option for both standard and stretchy behaviour in IK mode. By the way thanks for the link to Cesio’s Max Rig, because I hadn’t come across it. It’s added to the community rig list in my signature now :slight_smile:

On a hunch, I checked 2.5 – and sure enough, IK Stretch is keyable! It took some finagling and back-and-forth between 2.49 to get the drivers straight, but it works a charm.

(Something screwy with constraints’ transform orientations broke the Stretch switch dependency, so it has to be manually turned off, independent of the IK switch.)

Rather than bust my head any further, I think I’m just going to drop non-stretch IK in the meantime and wait for October.

Attachments

stretchy_leg_25.blend (180 KB)