Ciao!
I'd like to share some rigging research I did during my 3rd year of studying game development.
We were working on a year-long game project that would later turn into Muscle Magic! At the time, we were doing all sorts of research. I was curious if there was a feasible way to add squash & stretch to our rigs, with volume retention, and have it working in Unreal. I figured out a way to do it, so I hope I can help someone with their project by sharing it :)
This is the character that I created to test out the workflow. Very basic, I just wanted to test if the squash & stretch would work, and how to apply it to a spine as well as an IK chain. Also, he reminds me of Baymax, which is a big bonus in my opinion.
I built it so that all limbs (and the torso) have 2 joint chains in them. 1 regular one, to drive the rig as you would expect it, and 1 to scale the geometry for volume retention. The chains for scaling have about 8 joints each, and I added an IK spline handle to drive it. I skinned the IK spline curve to the regular joint chain, as well as the geometry of the character to the scaling chain. Then to add the volume retention to the regular joint chain, I dived into the Node Editor. I used a curveInfo node to get the worldSpace from the IK spline curve. Then I divided the arcLength from the curveInfo node by the scale X from each joint in the chain. Now I could add an attribute to the joints to control how much it should squash/stretch, and connect those to the scale Y and scale Z of the joints.
I also still had to figure out how to allow an IK chain to stretch further than its usual limit. I created a Distance Tool on the chain, parented the first locator of the Distance Tool to the first joint in the chain, and the second locator to the curve controlling the IK. I took the distance from the tool, divided it by itself, ran it through a condition node, and (if it was greater than the default stretched position) fed it to the scale X on the joints.
Then to export it to Unreal, I parented all joints to one ROOT joint that is positioned (0,0,0). The key to make it work, was that all meshes were parented to the torso, and the ROOT joint and the meshes had to be in the same hierarchy in the Outliner (so the joints aren’t grouped for example). I used the Game Exporter, selected both the ROOT joint and the Torso mesh and exported it. Then I could import it into Unreal, and walk around with my little squashy Baymax knock-off!
I mostly used these tutorials, you can check them out as well:
Maya Rigging Tutorial - Squash and Stretch Math Rigging Done The Right Way HD
Tutorial: Stretchy IK arm in Maya
Creating a Character Rig - Part 23: Stretch IK/FK arms
Building a Stretchy IK Chain in Maya
And if you are interested, feel free to reach out and I can share a document that I made at the time, which goes more in-depth through every step to set up this way of squash & stretch rigging. I'm als very curious if anyone knows any better ways to do it!
Thanks for reading!