# NNSG3dAnmObj

## Description

The `NNSG3dAnmObj` structure collects the data needed to fetch animation data from the animation resource. The structure stores the following data:

- The pointer to a single animation resource.
- The pointer to a function that computes animations
- The count of frames played.
- The animation blend ratio (used for motion blending).
- The table that shows the correspondence between: the model resource material IDs and joint IDs, and the animation resource index.

The `NNSG3dAnmObj` structure can be used for the playback of animation by registering it in the `NNSG3dRenderObj` structure with the `NNS_G3dRenderObjAddAnmObj` function. The following processes are necessary to use `NNSG3dAnmObj` for animation playback:

1. Secure a region for the structure using the `NNS_G3dAllocAnmObj` function. Note that the size of the structure will differ, depending on the number of material IDs and joint IDs for the model.
2. Initialize the `NNSG3dAnmObj` structure using the `NNS_G3dAnmObjInit` function.
3. Register animation object in `NNSG3dRenderObj` using the `NNS_G3dRenderObjAddAnmObj` function.
4. Use the `NNS_G3dAnmObjSetBlendRatio` function to set the blend ratio for the number of frames that will be played by the `NNS_G3dAnmObjSetFrame` function. (This is usually only done when multiple joint animations have been registered).
5. Draw the animation-attached model using the `NNS_G3dDraw` function.
6. To stop animation playback, use the `NNS_G3dRenderObjRemoveAnmObj` function to remove the animation object from `NNSG3dRenderObj`.
7. If `NNSG3dAnmObj` is no longer being used, release the structure's region using the `NNS_G3dFreeAnmObj` function.

`NNSG3dAnmObj` cannot be used for animation playback if drawing is performed with the `NNS_G3dDraw1Mat1Shp` function.

## See Also

Kernel

## Revision History

10/12/2004 Initial version.