Animation and Keyframes

Shockwave 3D§ has a simple representation for the motion of an object through space and time. Each unique bulk motion of each mesh in the scene and the internal motion of any skeletal figures are stored as separate IFXMotionResource objects in the Motion Resource Palette. A given motion in the Motion Resource Palette is associated with an object in the scene parameter using an IFXSkeletonModifierParam object attached to the object's IFXNode in the Node Hierarchy Palette.

Note: To animate group, light, and view nodes, you must first make the node a child of a mesh (which can be made invisible by the "sw3d_visibility" user property) and then animate the mesh. Group, light, and view nodes cannot be animated directly.

For example, to model a block that is flying through space, attach an IFXSkeletonModiferParam object (with an IFXKeyFrameModifierParam interface) to the IFXNode of the block in the Node Hierarchy Palette. The IFXSkeletonModiferParam tells the IFXSkeletonModifier object (with an IFXKeyFrameModifier interface) attached to the block's IFXModelResource object which IFXMotionResource in the Motion Resource Palette represents its motion.

A person skating across a pond, as another example, will have two modifier parameter objects chained to the IFXNode in the Node Hierarchy Palette, and two modifier objects attached to the IFXModelResource. An IFXSkeletonModifierParam object tells the IFXSkeletonModifier attached to the IFXModelResource how the skater moves his body as he skates by linking the model to an IFXMotionResource containing skeletal motion data. An IFXSkeletonModifierParam object with an IFXKeyFrameModifierParam interface will tell the IFXSkeletonModifier object with an IFXKeyFrameModifier interface attached to the skater's IFXModelResource which path (a different IFXMotionResource containing a single motion track) the skater takes across the ice.

Note: If an IFXModelResource uses both a keyframe modifier and a skeleton modifier, the skeleton modifier must come before the keyframe modifier. Likewise, if an IFXNode uses both a keyframe modifier parameter and a skeleton modifier parameter, the skeleton modifier parameter must come before the keyframe modifier parameter.

IFXMotionResources store animation data in one or more named IFXMotionTrack objects. An IFXMotionTrack object contains an array of IFXKeyFrame objects that specify a series of positions, rotations, scales and times for whatever is being controlled by that motion track.

The representation of motion in this manner helps to avoid redundancy. It is assumed that the motion made by one object may be applied to another object. The Motion Resource Palette allows you to collect all the animations happening in a scene, and then reuse them—or create a library of them—for any other objects in the scene, or any objects that might be added to the scene. If the skater jumps and spins, for example, after the "jump" and "spin" motions are in the Motion Resource Palette, you can make the skater jump and spin any number of times in any order, possibly even at the same time.

This approach is very useful with complex character animation systems. If the model has a library of facial motions associated with it that can be used to simulate any arbitrary speech motion, you can place all of these motions into separate IFXMotionResource objects, which in turn can be applied to the model's face using Macromedia Director§, just as they were in the authoring tool, under the control of the IFXSkeletonModiferParam object (which handles the blending between the various facial deformations).

Note: For skeletal animations to play, the track names in the IFXMotionResource must match the bone names specified in the IFXSkeletonModifier object attached to the object's IFXModelResource. Animation tracks that do not match bone names will not be played, and bones with no named animation tracks will not be animated.

§See asterisked (*) statement at Legal Information © 2001 Intel Corporation.