From BlenderWiki

Jump to: navigation, search

If you want to document Blender 2.5 features please edit pages under Doc:2.5/Manual.

If a "2.5" page doesn't exist please copy the text from 2.4x Manual and edit the new page (i.e. you should paste the wikitext from this 2.4x page to this new 2.5x page and then update the latter with 2.5 features)

A different way to have Objects move in the space is to constrain them to follow a given path. Sometimes objects need to follow a specific path through a minefield, or it is just too hard to animate a special kind of movement with the keyframe method. For example, a planet following its way around the Sun - animating that with keyframes is virtually impossible. In these cases, a special type of curve object called a Path can be used as the path for another object to follow.
There are two steps in animating an object to follow a path:

  1. Create the Path
  2. Tell the object to follow that Path

[edit] Creating a Path

Mode: 3D View Object Mode

Hotkey: Space → Add → Curve → Path

Path in Edit Mode

A Path is a special type of Curve object. Blender has a specific Path curve object, added as indicated in the reference box above, but any curve can be used as a path. So, for example, if you used a curve to show the groove in the toy track of a electric race car, you can use that same curve as the path for the race car itself. The two act the same, however there are some automatic features that make using a Path easier than a generic Curve.

The Path is made up of control points, initially 5, and has a linear direction shown by the the arrows in Edit mode. You can close a path by pressing C to make the path cyclic. In the example to the right, the path is going in the +X direction in a straight line (left to right).

Speed IPO: When you add a Path, a Speed IPO curve is also automatically added, shaped such that any object traversing the path smoothly accelerates at the start and then decelerates smoothly to a stop at the end of the path over 100 frames. You can view this Speed IPO curve in the IPO window, Path IPO type. This Speed curve overrides the Pathlen value. You can edit this IPO curve to change the speed and location of the object over whatever time period you wish, using the standard IPO editing features of Blender. The Y value represents the "percent complete" of the object along the path; 0.0 is the start of the path, and a value of 1.0 is the end. The X value is the frame of the animation. Thus, a sine-wave-shaped (sinusoidal, for you geometry geeks) Speed curve will make any objects that follow the path to move back and forth along the path in a very hypnotic fashion.

Like all objects, Paths are named in the Links and Materials panel or in the Properties panel, by default "Curve". This becomes important when you constrain an object to the path, because you have to enter the path's name in the Ob: field in the constraining panel. The older way to make an object follow a generic curve is to parent the object to the curve. This legacy technique is described below. The rest of this paragraph discusses using the Path object and Object Constraint method.

Select the object which you want to follow the path. In the Object (F7) context Object buttons, click Add Constraint->Follow Path. In the Target OB: field, enter the name of the path. The Constraint name button should turn from red to grey, and the center of the object will jump to the start of the path. Click here for more information on the constraint (see also its dedicated page in this manual).

[edit] Path Buttons Panels

The Curve/Path Editing Panels

The path has all of the normal curve tools available. Focusing on useful Path features, working left to right through the panels:

Curve and Surface Panel
CurvePath designates the curve as a path that can be followed (on by default). Objects can be translated (location) by the path, and if CurveFollow is enabled, also rotate to point along the path, like a train on a track. Similar to a Lattice, CurveStretch makes the object stretch, like a rubber band, along the path. Pathlen defines the default number of frames over which the object will traverse the path. A Speed curve provides much more control and, if present, overrides the Pathlen value.
Curve Tools Panel
You can change the type of curve (Poly, Bezier, Nurbs) which changes the way the control points influence the path. Each Control point has a weight, or influence, on the speed of the object along that part of the path. The preset buttons save you from typing numbers in the numeric field. The square root buttons calculate smooth acceleration/deceleration using the square root of 2 as a speed factor between points. Be sure to click Set Weight to lock in your change to that point.
Curve Tools 1 Panel
The Subdivide button is useful for inserting more control points between selected control points.

[edit] Changing the Path

Mode: 3D View Edit Mode

Hotkey: G to Grab, E to Extrude, C to toggle Cyclic

Menu: Curve→Extrude; Curve→Toggle Cyclic, Curve→Segments→Switch Direction

All the normal vertice editing controls are available, mostly Grab. Special Curve tools (like Cyclic, which make a closed path) are also available. Of special note:

Extrude
used to extend either the start or the end of the path. With the start or end point selected, either Extrude or CtrlLMB File:Template-LMB.png click to add points to that end of the path.
Switch Direction
swaps the path start and end points
Anim settings Panel
the TimeOffset numeric at the bottom of this panel specifies when in time this path starts influencing its objects

[edit] Following a Path

Path Constraint on Object

With your object selected, add a Follow Path constraint to the object. Enter the name of the Path, and specify the orientation. Paths have a local XYZ orientation, and the buttons align your object's local orientation to the path. In this example to the right, our favorite monkey has a "Timid" constraint to follow the path named "ToBanana". The path only influences her motion by about 50%, so she does not follow the whole path, but is only displaced by half the path length. She starts along the path to the banana at frame offset 50. The actual start frame is this offset plus the Path's animation setting for TimeOffset.

When you add a constraint, the object moves relative to the path, but does not have to physically follow that path in the same 3D space. It can be physically apart (beside, away from) the actual curve. This allows you to have a generic path, like "Falling in the wind" and then model many Leaves ("Leaf.001", "Leaf.002", etc.). Each leaf is moved away from the path and thus follows the path, but in its own space. Any Ipo Curves for that object are still in effect as it moves along the path, allowing you to let the object swivel left or right as they walk along the path, like a cartoon bird spinning and sliding on the ice.

[edit] Speed/Progress via Time Curve

You control the amount of time (actually the object's percentage progress) by RMB File:Template-RMB.png selecting the curve and, in the IPO window, LMB File:Template-LMB.png selecting the Time channel. Then CtrlLMB File:Template-LMB.png click to add interpolation points at various frames, with the Y value between 0 and 100 reflecting the progress or distance along the path the object should be at that time (frame). If the curve is increasing, motion is forward; if the curve is decreasing, motion is backward. Thus, a simple sine wave (extended cyclic) curve will make an object swing back and forth along the path forever.

Paths can follow other Paths:
Just add the FollowPath constraint to a path. For example, a standard "out of the ballpark home run" baseball trajectory can be offset by the wind path.


[edit] Legacy Path Method

Blender 2.37-+
Editor's Note
The following text was in place prior to Version 2.43. It is preserved here for users of older versions, and for working with old blend files that use the old method of path animation. The spaceship example is still relevant and helpful in explaining/providing more detail.

As for tracking, there are two Path animation methods, the old, pre 2.30 method described here and the new method, which actually defines a constraint, which will be described in character_constraints.

When parenting an Object to a Curve, you will be asked to choose a Normal Parent or a Follow Path option. The Former is what you need for conventional Path animation, but other actions needs to be taken later. The second option creates a "Follow Path" Constraint, and it is all you need to do. If, when following a path, the dashed line between the object and path goes to the wrong end of the path simply clear the parent, select the path and go into edit mode. Select all the control points and select, in the Curve Menu, segments and select switch direction, then re-parent the object to the path. Any kind of curve can become a path by setting the option CurvePath Toggle Button in the Animation Buttons window (F7) to ON (The Action Window with Path Buttons.).

When a Curve has children objects it can be turned to a Path by selecting it, going int0 the Editing Context (F9) and activating the CurvePath Toggle button in the Curve and Surface Panel. Child objects of the Curve will now move along the specified path. It is a good idea to set the Curve to 3D via the 3D Toggle Button of the Curve Edit Buttons so that the paths can be freely modeled. Otherwise, in the ADD menu under Curve->Path, there is a primitive with the correct settings already there. This is a 5th order NURBS spline, which can be used to create very fluid, continuous movements. Normally a Path is 100 frames long and it is followed in 100 frames by children. You can make it longer or shorter by varying the PathLength: Num Button. The speed along a path is determined with an appropriate curve in the IPO Window. To see it, in the IPO Window Header button you must select the Curve type for the IPO block. A single channel, Speed is there. The complete path runs in the IPO Window between the vertical values 0.0 and 1.0. Drawing a curve between these values links the time to the position on the path. Backward and pulsing movements are possible with this. For most paths, an IPO Curve must run exactly between the Y-values 0.0 and 1.0. To achieve this, use the Number menu (N) in the IPO Window. If the IPO Curve is deleted, the value of PathLen determines the duration of the path. A linear movement is defined in this case. The Speed IPO is a finer way of controlling Path length. The path is long 1 for time IPO, and if the time IPO goes from 0 to 1 in 200 frames then the path is 200 frames long. Using the option CurveFollow, in the Curve and Surface Panel, a rotation is also given to the Child objects of the path, so that they permanently point in the direction of the path.

Tracking Buttons

Use the "tracking" buttons in the Anim settings Panel of the Object (F7) context to specify the effect of the rotation (Tracking Buttons ) as you would do for Tracking:

  • TrackX, Y, Z, -X, -Y, -Z This specifies the direction axis, i.e. the axis that is placed on the path.
  • UpX, UpY, UpZ Specifies which axis must point 'upwards', in the direction of the (local) positive Z axis. If the Track and

the Up axis coincides, it is deactivated.

Note
Curve paths have the same problem of Beveled curves for what concern the definition of the "Up" direction.


Complex path animation (Click for larger image)

To visualize these rotations precisely, we must make it possible for a Child to have its own rotations. Erase the Child's rotation with AltR. Also erase the "Parent Inverse": AltP. The best method is to 'parent' an unrotated Child to the path with the command Ctrl⇧ ShiftP: "Make parent without inverse". Now the Child jumps directly to the path and the Child points in the right direction. 3D paths also get an extra value for each vertex: the 'tilt'. This can be used to specify an axis rotation. Use T in EditMode to change the tilt of selected vertices in EditMode, e.g. to have a Child move around as if it were on a roller coaster. Complex path animation shows a complex application. We want to make a fighter dive into a canyon, fly next to the water and then rise again, all this by following it with our camera and, possibly, having reflection in the water! To do this we will need three paths. Path 1 has a fighter parented to it, the fighter will fly following it.

The fighter has an Empty named 'Track' Parented to it in a strategic position. A camera is then parented to another curve, Path 2, and follows it, tracking the 'Track' Empty. The Fighter has a constant Speed IPO, the camera has not. It goes faster, then slower, always tracking the Empty, and hence the fighter, so we will have very fluid movements of the camera from Fighter side, to Fighter front, other side, back, etc. (Some frames, the camera fluidly tracking the fighter.)

Some frames, the camera fluidly tracking the fighter. (Click for larger image)

Since we want our fighter to fly over a river, we need to set up an Env Map for the water surface to obtain reflections. But the Empty used for the calculations must be always in specular position with respect to the camera... and the camera is moving along a path! Path 3 is hence created by mirroring path 2 with respect to the water plane, by duplicating it, and using M in Edit Mode with respect to the cursor, once the cursor is on the plane. The Empty for the Env Map calculation is then parented to this new path, and the Time IPO of Path 2 is copied to Path 3. A frame of the final animation. shows a rendered frame. Some particle systems were used for trails. The scene presents many subtle tricks, as particles for the jet streams, fog, a sky sphere encircling the scene and so on.

A frame of the final animation.