3
$\begingroup$

I've searched google extensively on this. Can't seem to find an answer.

I know about spline IK, which is wonderful for conforming a row of bones to a path. But combining the armature object with a follow path modifier causes the point of origin to move, but the bones themselves stick to the beginning of curve.

Ultimately my goal is to make a creature like a snake or centipede follow a curve path, thus animating it fairly realistically ...

$\endgroup$
5
$\begingroup$

Mesh and curve modifier.

enter image description here Once set up can travel along curve by displacing our dummy edge object

Having tried a method similar to @moonboots answer in writing a train addon found using the method outlined below kept the wheels on track (better if the curve is too tight nothing will help). This may not matter too much with a deforming object like a snake. However it only requires making one very simple mesh object, with vertex groups as tagets for bone constraints.

Trying to place empties on the curve with offsets will cause the "train to derail" as the offset is looking at curve length rather than where the line segment next meets the curve. For example a unit circle radius 1, can hold a square with edge lengths sqrt(2) each corner touches the circle. The arc length is p1 / 2 Trying to get the empty locations right on a complex curve is IMO too hard. If a mesh is created and threaded onto a curve with a modifier the edge lengths are preserved.

Create a simple mesh as shown. With edges and verts emulating bones.

enter image description here Here the mesh is moved 1 over for visual

enter image description here

Add a curve modifier to the mesh. I've made the mesh z up to cooncide with bones global orientation, so I track the mesh on curve using Z. The mesh can "run on the tracks" by animating its Z location property. Can switch tracks by changing this one modifier target

enter image description here

Next we add a copy location constraint of root bone to our mesh object, with base vertex group as a subtarget, and a track to constraint along the axis of bone "Y" to the next vertex group.

For all subsequent bones in chain add track to constraint to next vertex group.

$\endgroup$
  • $\begingroup$ nice! It's true that the method I explained will force to correct the Offset every time we change the curve length $\endgroup$ – moonboots Feb 27 at 12:38
  • $\begingroup$ Both answers are good but this one seems pretty reliable. $\endgroup$ – Leo Blanchette Feb 28 at 0:44
3
$\begingroup$

To make a snake-like animation you can do it the way I explain below (inspired by bugzilla2001 here: https://www.youtube.com/watch?v=VXheGvyEz3A& ).

But as batFINGER said it has a drawback because as it uses the Follow Path Offset, each change you'll make on the curve length will imply an adjustment of the Offset...

Anyway, here it is:

  • Create your object (snake, train...).
  • Create the armature.
  • Parent the object to the armature.
  • Create an empty at the beginning of the armature.
  • Parent the armature to the empty.
  • Create your road with a curve. Change its direction with a W > Switch Direction if necessary, put its origin at its beginning.
  • Put your empty at the center of the scene with an altG.
  • Give your empty a Follow Path constraint and choose the curve as the Target. The empty will stick to the beginning of the curve.
  • Duplicate the empty with a shiftDenter.
  • Change the Follow Path Offset of this second empty so that it is separated from the first with a distance of approximately one bone.
  • Create as many empties as you have bones, and again change the Offset of each one.
  • In Pose mode, select the first bone and give it a Track To constraint, with its empty as Target.
  • Do it for each bone. Then correct the Offset of each empty so that it sticks to its bone tail.
  • If you play the animation with altA, the armature should follow and the whole object should bend along.
  • To set the animation parameters and speed yourself, select the curve, go in the Graph Editor, select the Evaluation Time track, open the properties with N, press the Modifiers tab and remove the Generator.
  • Now in the Properties panel > Data > Path Animation, you can keyframe the Evaluation Time yourself.

enter image description here

$\endgroup$
  • $\begingroup$ Even without adjusting curve length, within the curve. Didn't explain it too well with square in circle analogy. The offset is analogous to the length of the curve between point A and B, for a train we want to keep the length of line segment constant between points A and B. Eg if our track was a length 4 straight line for a part then a radius 1 semi circle to end the total length would be L = 4 + pi A unit carriage on straight part would have delta offset of 1 / L between tip and tail when on the circle would be pi/ (2 * L) $\endgroup$ – batFINGER Feb 27 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.