EvilEngine/ANIM

From Heavy Iron Modding
(Redirected from ANIM)

ANIM
Animation
TypeBinary
Games usedNight of 100 Frights

Battle for Bikini Bottom
The SpongeBob SquarePants Movie
The Incredibles
Rise of the Underminer

Ratatouille Prototype
Source codeiAnimSKB.h

Tools

The following tools can be used to work with ANIM files.

BFBBAnimTools

This is a 3ds Max script written by Seil for working with ANIM files. See BFBBAnimTools for the tool page. See Custom Animations for a tutorial.

ANIM Importer (Deprecated)

These are scripts to import most .ANIM files into 3ds Max. You really should not use these. They are listed for historical reasons.

Format

Animation assets are stored using the SKB format. The overall format looks like this:

iAnimSKBHeader header;
iAnimSKBKey keys[header.KeyCount];
float times[header.TimeCount];
unsigned short offsets[header.TimeCount - 1][header.BoneCount];

Header

The header is defined by an iAnimSKBHeader struct:

struct iAnimSKBHeader
{
	unsigned int Magic;
	unsigned int Flags;
	unsigned short BoneCount;
	unsigned short TimeCount;
	unsigned int KeyCount;
	float Scale[3];
};
  • Magic is always 'SKB1'.
  • Flags
  • BoneCount is the number of bones in the model.
  • TimeCount is the number of times (frames) in the animation.
  • KeyCount is the total number of keyframes in the animation.
  • Scale

Keys

Each keyframe in the keys array is defined by an iAnimSKBKey struct:

struct iAnimSKBKey
{
	unsigned short TimeIndex;
	short Quat[4];
	short Tran[3];
};
  • TimeIndex is an index into the times array
  • Quat represents an quaternion rotation (X, Y, Z, W) for a bone at this keyframe.
  • Tran represents an offset position (X, Y, Z) for a bone at this keyframe.

Times

The times array maps each frame of the animation to a time in seconds. Typically this starts at 0 and increases by a multiple of 0.01666... (1/60th of a second). The last time in the animation can be interpreted as the length of the animation in seconds.

Offsets

The offsets array maps each bone in the model to a starting index in the keys array, for each time (frame) in the animation (except for the last one, because it signifies the end of the animation and doesn't have a keyframe associated with it).

For example, if a model has 3 bones, and each bone has a keyframe on every time (so 3 keyframes per time), then the offsets array would look like this:

offsets[0][0] = 0
offsets[0][1] = 3
offsets[0][2] = 6
offsets[1][0] = 1
offsets[1][1] = 4
offsets[1][2] = 7
offsets[2][0] = 2
...