# Create View Script

The purpose of the view animation window is to convert an animation table into an animation script controlling the view size, view position and view orientation. See also the object animation window, which creates scripts to control modelled objects, and the specialized track animation window, which assists in modeling and animating articulated tracks.

## Output File

The first entry box in the view animation window is labeled Output file. This box specifies the filename to be used when the animation script is created. If the file already exists, the user will be notified and given the option of overwriting the existing file or choosing a different filename.

## Source

The animation tables driving the output script may come from curves, view curves, table editors, or files. The type of source is selected using the option menu next to the Source label. An appropriate source name should then be entered into the associated entry box. The source name is simply the name of the curve, view curve, or file, or it is the integer identifier of the table editor.

Below the Source label, AnimMate provides a short description of the parameters that columns of the source table should provide This description changes depending which of the window's checkbuttons are selected. For example, when the No Rotation checkbutton is active, and the Read viewsize from source button is inactive, AnimMate only needs to know the time of each frame and the position of the eye. In this case, the source description reads:

4 input columns needed: t x y z

The following codes are used to describe the column contents:

    t               - time column
    v		- viewsize column
    x y z           - three columns: path through space
    y p r           - three columns: yaw, pitch, and roll
    qx qy qz qw     - four columns: quaternion coordinates
    lx ly lz        - three columns: path for eye to look toward

If the number of columns in the source doesn't match the number of columns needed, an error message is displayed when the OK button is invoked. A curve always contains four columns, while the number of columns in a view curve, table editor, or file may vary.

## View Size

If a constant view size is desired, it may be specified in the entry box corresponding to the View size label. As an alternative to keyboard entry, the user set the MGED display window to the desired viewsize and then click on the View size label to automatically enter the current viewsize into the entry box. This entry box is ignored when the Read viewsize from source checkbutton is active.

## Object Center, Eye Point, and Object and Eye Orientation

The four entry boxes labeled Object center, Object yaw,pitch,roll, Eye point, and Eye yaw,pitch,roll are used when the source animation table refers to an object, and the user wishes to rigidly attach the eye to the object in some way. For example, the user might want to attach the eye to a point behind the windshield of a car to to show the view from the driver's seat as the car drives around.

As explained in the section on Object Center and Orientation, when animating objects the user must provide a center point and an initial orientation. The center point is the point on or near the object which is moved to the positions in the animation table, and about which rotations occur. The initial orientation defines which direction the object considers to be forward, left, up, and so on. The same center point and orientation used in creating the object animation script should be used in creating a rigidly attached view script.

The object center and object yaw, pitch, and roll can be keyboard-edited after clicking on the corresponding entry box with the mouse. As an alternative to keyboard entry, the user can press the Object center button to enter the current center point of the MGED display window, or press the Object yaw,pitch,roll button to enter the current orientation of the display window.

Next, the user must specify the position and orientation in which the eye should be attached to the object. For example, suppose that the object being animated is centered at the origin. If the user specifies `(0,0,100)` as the eye point, and `(0,-90,0)` as the eye yaw, pitch, and roll, then the eye will look down on the top of the object from a distance of 100mm during the entire animation.

The eye position and eye yaw, pitch, and roll can be keyboard-edited after clicking on the corresponding entry box with the mouse. As an alternative to keyboard entry, the user may press the Eye Point button to enter the current eye point of the MGED display window, or press the Eye yaw,pitch,roll button to enter the current orientation of the display window.

## First Frame

An animation script is made of of a series of numbered frames. Each frame gives animation commands needed for one image in the final product. By default, the frames numbers for a given script begin at zero. If a different initial frame number is desired, it may be entered in the First Frame entry box. For example, the first frame number might be set to 300 when creating a script which will be appended onto the end of another script which is 300 frames long.

## Read Viewsize from Source

If this checkbutton is active, the viewsize for each frame will be read from the source animation table rather than from the View size entry box. In most cases, the viewsize must be provided explicitly in the second column of the animation table. The exception is when the Orientation control is set to Eye path and look-at path. In this case, viewsize is calculated in each frame from the distance between the eye path and look-at path.

## No Translation

If this checkbutton is enabled, then AnimMate will only expect to read time and orientation information from the source animation table, and the animation script will only rotate the view. The No Translation button can only be enabled if either Rotation specified as ypr or Rotation specified as quat are specified in the Orientation controls section.

## Orientation Control

The user may select one of the following six options for specifying the view orientation:

No Rotation
  The view orientation will not change during the animation. The source animation table contains no orientation information, and the yaw, pitch, and roll are assumed to be zero in every frame.

Automatic Steering
  Given an source animation table containing time and position columns, this option produces an animation script which always orients the view in the direction the eye is moving. The view is always oriented "right-side up", that is, with yaw and pitch but no roll.

Automatic steering and banking
  This option is similar to the previous option except that the animation script banks the view into turns, simulating the behavior of an aircraft. The severity of the bank depends directly on the sharpness of the turn, and is scaled so that the view reaches the maximum bank angle at the point in the animation table with the sharpest turn. The maximum bank angle, which defaults to 60 degrees, can be set to any value between -89 and 89 degrees by editing the corresponding entry box. Negative values cause the view to bank in the opposite direction, like a cart almost overturning as it rounds a corner. A maximum bank angle of zero causes no banking to occur.

Rotation specified as ypr
  The last three columns in the animation table give the view's yaw, pitch, and roll in each frame.

Rotation specified as quat
  The last four columns of the animation table give the view orientation as a quaternion, in the order x, y, z, w. The convention is the same as the quaternions returned by MGED's viewget quat command: the identity quaternion (0,0,0,1) represents the default view, facing the negative z-direction with the x-axis to the right. This is equivalent to a yaw, pitch, and roll of (90,-90,0). The quaternion (0.5, -0.5, -0.5, 0.5) leaves the view in the default object position, corresponding to a yaw, pitch, and roll of (0,0,0).

Eye path and look-at path
  This option requires that the animation table contain a path for the eye to follow and a path for the eye to look toward. The view will be oriented "right-side up" along the axis defined by the two points given in every frame. If the Read viewsize from source checkbutton is active, the viewsize is calculated as twice the distance from the eye point to the look-at point; otherwise, the viewsize comes from the entry box labeled View size.

## Other Buttons

OK
  Create the animation script, leaving the view animation window in place for further work.

Show Script
  Display a window which can be used to run the animation script in the MGED display window.

Up
  Raise the view animation window's parent to the top of the stacking order.

Cancel
  Close the view animation window.

Next Section: Track Animation

Previous Section: Create Object Script

Index