Models and Skeletal Data

Skeletons/Bones are used to animate the deformation of an IFXMeshGroup over time. Information on all the bones used in the skeleton, and how they influence the mesh, is stored in an IFXSkeletonModifier, which is attached to the IFXModelResource.

As with keyframe animation, use a modifier to have a model deform with skeleton animation:

  1. Create an IFXMotionResource object to hold all information about the motion of the skeleton (named tracks for each bone that moves, each track containing keyframes) and add a reference to it to the Motion Resource Palette. Don't add duplicate motions to the Shockwave 3D§ database.

    Note: Name the motion for the model it 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 an IFXSkeletonModifier modifier to the IFXMotionResource for the model.

  4. Create an IFXSkeletonModifierParam object, which will be attached to the appropriate IFXNode in the Node Hierarchy Palette.

  5. Link the IFXSkeletonModiferParam to the IFXSkeletonModifier object of the appropriate IFXModelResource with the IFXSkeletonModiferParam:SetModifier() method.

  6. Assign a motion, by name, to the modifier parameter using the IFXSkeletonModifierParam::Push()method.

  7. Add the IFXSkeletonModifierParam object to its IFXNode using the IFXNode::AddModifierParam() method.

Now that you have created the IFXMotionResource, you must load it with the motion for each bone. If a bone moves, create a track for it in the IFXMotionResource using the IFXMotionResource::AddTrack() method and name it for the bone it is for. Find all motion keyframes for the bone (sampling its motion many times is necessary), put these into an array of IFXKeyFrame objects, and then insert the keyframes for the track into the motion resource with the IFXMotionResource::InsertKeyFrames() method.

Note that the following methods in the S3DsceneGraphUtils utility class can help you with this process: AddSkeletonToModelResource(), AddMotionResource(), CompressMotionTracks(), and AddSkeletonParamToNode().

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