Both anim_script and tabsub use one row of an animation table to produce one frame of an animation script. With tabsub, the user supplies a template file which controls the form of the animation frames. This allows the maximum user control, but also requires a good understanding of the script format. With anim_script, the user supplies all the necessary information on the command line. The range of possible output scripts is limited, but the user does not have to deal directly with the details. Both routines have special features which make certain common situations easy to do. One of the most important special features of anim_script is the ability to specify a reference position and orientation, as explained below.
The objectname is the name of the object being animated and its parent, as it should appear in the output script. For example, if "hatch1" is a member of the group "turret", then the objectname "turret/hatch1" would be used to animate the hatch. A top-level object is proceeded only by a slash; the whole tank might be referred to by the objectname, "/tank". If view animation is being performed, no objectname is needed.
in.table is usually a seven-column animation table, specifying the time, 3d position, yaw, pitch and roll of the object (or camera), although the number of columns is affected by the -r, -t, -s, and -v# options.
viewsize #;
will be placed at the beginning of the output file. If it is zero, the `viewsize' command is omitted from the output script. If it is negative, then the viewsize for each frame is read from in.table. In this case, the second column of in.table should be the viewsize column; the column is inserted between the time column and all of the other columns. A `viewsize' command is then included immediately after the `start' command of each frame.
The remaining options give information about the object which is to be animated.
When the -v option is used, the virtual camera is the object being animated, and so the meaning of the preceding four options changes somewhat. The -c and -a options are not useful in this context. The -d option can be thought of as specifying the position and orientation of a virtual tripod with respect to the camera lens. The translations and rotations specified in the input table will be applied to the tripod, to which the camera is rigidly attached. For example, the option -d 10 0 -2 in conjunction with the -v# option means that the virtual tripod is 10 units in front of the camera and 2 units below the camera's line of sight. The option -b -90 0 0 in this context would mean that the front of the virtual tripod faces 90 degrees to the right of the virtual camera. As translation and rotation information are read in from in.table, they are applied to the virtual tripod, with the virtual camera rigidly attached. See below for examples of how this might be used.
lmul - left-multiply the matrix onto the current arc rmul - right-multiply the matrix onto the current arc rarc - replace the current arc with the matrix rstack - replace the stack of ancestor matrices with the matrix rboth - replace the current arc with the matrix and replace the stack of ancestor matrices with the identity matrix.This option is intended primarily to give expert users additional flexibility, and shouldn't be needed by most animators.
anim_script -d 234 0 1200 /truck < truck.table > truck.script.
If the front of the model truck faces (for some reason) halfway between the x and y axes, a -b option is added, to show the relationship between world and truck axes:
anim_script -b 45 0 0 -d 234 0 1200 /truck < truck.table > truck.script.
To steer the truck automatically to face the direction of motion, the -s option is added, and the orientation columns should be removed from truck.table.
anim_script -s -b 45 0 0 -d 234 0 1200 /truck < truck.table > truck.script.
Animating a steering wheel: Suppose the steering wheel is stored in the database so that the axis it turns on is at an yaw of -135 degrees and an pitch of 30 degrees. It passes through the point (700,800,2400). Then we select "rotation only" with -r and specify the relationship between the steering wheels axes and the world with the -a and -c options. In roll.table we put the time, two zero columns, and a column specifying the roll of the wheel (How much it is to be twisted).
anim_script -r -a -135 30 0 -c 700 800 2400 truck/steering_column/wheel < roll.table > steer.table
Alternatively, if the rotation of the wheel was stored in the yaw (second) column of a file, turn.table, a different set of axes would be used to achieve the same effect:
anim_script -r -a 45 60 0 -c 700 800 2400 truck/steering_column/wheel < turn.table > steer.table
To animate seven little men doing simultaneous backflips in different places, you would want to use relative motion. That is, a translation vector of (0,0,1) means move one unit upward, instead of move to the point (0,0,1). For each little man, we specify his position in the model using the -c option. Then we can use the same backflip instructions for each of the little men.
anim_script -c 12 34 5 /little.man.one < generic.backflip.table > little.man.one.script
anim_script -c -3 13 5 /little.man.two < generic.backflip.table > little.man.two.script
and so on.
anim_script -v0 < view.table > view.script
To follow a truck, so that the camera is always ten units behind and 4 units above it, we specify a virtual tripod in front of and below the camera:
anim_script -v0 -d 10 0 -4 < truck.table > view.script
To do the same thing but with the camera turned to look at the right side of the truck, we specify that the virtual tripod originally faces to the right, so that the camera faces its right side. Thus when the virtual tripod is placed in the same position and orientation as the truck, the camera will be looking at the right side of the truck.
anim_script -v0 -d 10 0 -4 -b -90 0 0 < truck.table > view.script