Parametric Motion Control
Parametric motion control is the specification of the position and orientation of actors in an animation sequence as a function of time. Parameters are defined in the Animation Parameters dialog, which is opened by selecting in the Animation Producer dialog.
Animation of complex assemblies can be very difficult with keyframing. In these cases you can use parametric motion control, which lets you specify geometry position and orientation as a function of time. This is an attractive alternative, particularly when you know the equations of motion. A set of built-in variables and functions is available to assist in defining these equations. Additionally, you can define new variables, based on the built-in variables, or any user-defined variable.
Parametric motion is defined relative to the axes of the actor, which are defined when the actor is created. During scripting, the parametric motion is defined relative to frame numbers.
Parametric motion is defined when scripting an actor. Here, in the Script Actor dialog, rotation about the Z axis has been defined as 5° per frame.
Scripting Parametric Motion
Parametric motion control is especially useful in these situations:
- To animate complex assemblies, which is very difficult with keyframing alone.
- When the equations of motion are known.
It is possible to script parametric motion for an actor that will take place while the actor is moving along a path. Motion along a path is scripted with the Define Actor Path tool.
To make it easier to define equations of motion, a set of built-in variables and functions is provided. Additionally, you can define custom parameters based on the built-in variables or any variable that has previously been defined.
Defining Custom Parameters
Often the same parameters are used in multiple equations of motion in different models. You can save time by using built-in variables and functions to define custom parameters. Once you define a custom parameter, you can refer to it by name when scripting actors.
For example, consider a custom parameter, named revolution, defined as follows:
An actor whose motion is scripted as revolution rotates one full rotation during the course of the animation sequence, no matter how many frames are used. This is determined as follows: dividing 360 (degrees) by the total number of frames (maxFrame), gives the rotations per frame. This, in turn, is multiplied by the current frame number (frame).
Mathematical operators can be applied to custom parameters in the same manner as to built-in variables. Continuing with the example, in scripting an actor to rotate, you could use the following:
2*revolution — to rotate the actor 720°
revolution/2 — to rotate the actor 180°
Each newly defined custom parameter is stored in the active script along with the script entries themselves. You can then include this script in other scripts. Where you have commonly used parameters, you can place these in a separate DGN file and then import them as required.
Reviewing Parameter Values
When reviewing or debugging your animation script, you can retrieve the current values of parameters. The key-in ANIMATOR PARAMETER DUMP outputs into a debug text window the current values for any parameters used by the sequence. You can use this key-in for any time/frame number.
Creating/Importing Commonly Used Custom Parameters
Custom parameters that have been created in other models can be imported into the current model. This may be from the active DGN, where parameters have been created in other models, or they can be imported from another DGN file.
This same procedure can be used to store commonly used custom parameters in a separate DGN file, ready to import into other models as required. This lets you create a "library" of animation parameters and saves having to re-create them each time in new models or DGN files.
To import parameters from another DGN file, use the key-in: ANIMATOR PARAMETER IMPORT <file_name>.
When you import parameters, all parameters from all models in the DGN file are imported.