In Lunchtime RPG, I wanted to create an earthworm mini-boss you would defeat in order to pay a giant bird to fly you to your next destination. I had some difficulty deciding how to animate a curvy object like an earthworm. How do I turn this earthworm.png into something a bit more lively?
![]() |
![]() |
My first idea was to use bones, but this has two issues. If I don't use enough bones, then the worm just looks like a zig-zag made up of straight line segments. If I use more bones, then it still looks like a zig-zag (with smaller line segments), and it becomes a massive pain to animate.
Boned earthworm: looks terrible.
So I created my own component called the "Curve Renderer," which looks like this:
You control the guide points that you want the curve to pass through, as well as "tangent pullers" that can be pulled around to adjust the curvature. It's very easy to use, works great with Unity's Animator, and I even wrote my own implementation of the FABRIK algorithm to use with it, so that you can give it Inverse Kinematics effects (Unity's built-in IK requires a bone rig). The earthworm's strike attack shown above is just setting the IK target to the player's transform and flicking the IK on and off. You can have different IK effects affecting different portions of the curve, and you can adjust the strength of the IK effect, too (how closely the effector should follow the target).
Here's what it all looks like in action. (As you can see, for collision I'm just using capsule colliders attached to each guide point -- this has been good enough so far but ideally I'd like to write custom collision for it.)
And here is what the inspector looks like for the Curve Renderer components attached to the earthworm (there are really two components, the "Visual Curve Guide" and the "Curve Renderer").
The Curve Renderer turned out to be super useful, and I ended up using it for a bunch of other things, like rope swings, swimming eels, and these evil roots that shoot out of a soil platform and try to grab you.
Wheeee, rope swing!
Evil roots and baby eels, both procedurally animated using Curve Renderer.