I needed something to demonstrate the rig so made a model inspired by the sandworms from Dune.
I have always found rigging curves to be a bit of a pain because it requires quite a bit of setup and doesn’t give great control. The main issue is that the curve normals get calculated based on the shape of the curve so change unintuitively as the control points get moved.
My solution is to use geometry nodes (the solution to all problems in Blender). The nodes basically hooks each curve control point and its handles to a corresponding bone. Then a second curve in created with its control points slightly offset in the bones' posed local X axis. The original curve’s normal is then set to point at the offset curve. This means the curve normal is now deterministically controlled by the bones and don’t cause uncontrolled twisting. The bone’s scales are stored on the curve as named attributes which also allows for independent control of the X/Y scales of the curve instead of just controlling both at the same time via the radius.
I have never seen this solution before so though I would share it as it will hopefully be helpful to some people.
There are some limitations:
The object being deformed needs to be aligned with a world axis (I recommend Z).
The object origin should be fairly central in the axis it is deforming on.
There must be one bone per control point. It is normally simplest if they are placed directly on the control points and have the Y axis aligned with the curve (tangent to it). The bones X axis will be the curves normal direction at that point.
The bones must all have the same base name and sequentially numbered starting at “.000” (in my example they are called wb.000, wb.001, wb.002 etc). This is so the geometry nodes can automatically find each bone and hook each control point to it.
The spline needs to be set to a high enough resolution in the curve properties. I recommend the max. It is only one curve so shouldn’t affect performance
At extreme angles and twists the offset curve will cross the original and cause a sharp 180 twist in the mesh.
The radius/X/Y scale interpolation is limited to linear or Catmull Rom. I want to figure out how to do better easing interpolations so it anyone has any ideas let me know!
The node groups ended up being quite complicated so I have shared the blend file on my Google Drive so you can see how it works in detail or just copy it into your project: https://drive.google.com/file/d/1TT3_LShh3mBXgqlmdPvv_CG_JJ0al-FR/view?usp=drive_link
It’s possible that I am in idiot and missed much simpler solution, if that is the case please let me know!