Models and Keyframe Data

Bulk motion of a model in Shockwave 3D§ is specified through keyframes. Because motions might be shared by more than one object, object keyframes are not stored in the object's IFXModelResource. Instead, an object is made to move by attaching an IFXSkeletonModifier object to it. To specify the motion of an object in Shockwave 3D, you must:

  1. Create an IFXMotionResource object to hold all information about the motion (its keyframes and tracks) and add a reference to it to the Motion Resource Palette. Make sure not to add duplicate motions to the Shockwave 3D database.

    Note: Motion names that represent simple keyframe information should end in the string "-key," and the motion name should indicate the model the motion is for.

  2. Create an IFXMixerConstruct object that points to the new IFXMotionResource, and add a reference to the mixer to the Mixer Resource Palette.

    Note:The method S3DsceneGraphUtils::AddMotionResource() takes care of steps 1 and 2 for you.

  3. Add a track to the IFXMotionResource, create an array of IFXKeyFrame objects, populate these keyframes, and then insert those keyframes into the track.

    Note: Track names should indicate the model the motion is for but without the string "-key" at the end.

  4. Add an IFXSkeletonModifier object with an IFXKeyFrameModifier interface to the IFXModelResource for the model. An object of type IFXKeyFrameModifier will be returned.

  5. Create an IFXSkeletonModiferParam object with an IFXKeyFrameModifierParam interface. An object of type IFXKeyFrameModiferParam will be returned.

  6. Indicate that an IFXNode should use a motion modifier attached to its IFXModelResource by linking an IFXSkeletonModifierParam object (attached to the IFXNode) to an IFXSkeletonModifier. With animation data, this is done by calling the IFXKeyFrameModiferParam::SetModifier() method.

  7. With an IFXSkeletonModifierParam object linked to an IFXSkeletonModifier object, assign a motion, by name, to the modifier parameter object using the IFXKeyFrameModifierParam::Push() method.

  8. Add the IFXKeyFrameModifierParam object to its IFXNode using the IFXNode::AddModifierParam() method (this step is not part of step 4 for initialization reasons).

    Note: If the model has both skeletal animation and keyframe animation applied to it, the IFXSkeletonModifier object with the IFXKeyFrameModifier interface must be applied after the IFXSkeletonModifier object with the IFXSkeletonModifier interface in the modifier chain.

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