Stretchy Spline IK Script
Updated: May 21, 2021
Today I'll be talking about my Stretchy Spline IK Script! It is based on this great tutorial by the Maya Learning Channel on Youtube: "Creating a Character Rig - Part 5: Torso squash and stretch (Advanced)"
First we'll go ahead and setup the chain itself with everything we'll need, then we'll run the script and see the magic happen in the node editor!
The script works around an IK Spline chain. It takes the current length of the curve and divides it by the original length, which gives us a percentage of how much that curve was stretched. It then takes the scale of the down axis of all joints and multiplies them by that value. As a result, the joint chain scales to match the stretch of the curve.
It also takes volume preservation into account, so while the down axis is being scaled one way, the side axes will be scaled the opposite. The value of this operation will be 1/sqrt(down axis scale). Here's a few diagrams taken from the video I mentioned earlier (highly recommend it!):
It's a very simple script but it saved my life when I had to rig an octopus in college. Once I finished my first stretchy tentacle I knew there was no way I wanted to do that 7 more times manually. haha
Keep on riggin'!