KEY Files General
KEY files (or Keyframe files) are used to animate the various nodes of a 3DO in accordance to an action the 3DO is making. Other uses of Keyframes include moving the camera around (such as at the start of each boss level when Rahn talks to you) and to create ships's flying sequences (such as the TIE Bomber, Crow and 8t88's Shuttle).
KEYs are broken into two sections, with a possible third.
FLAGS # 32-bit value specifying properties of this Keyframe TYPE # 32-bit value specifying the type of Keyframe FRAMES # The number of frames in the animation sequence FPS # Frame rate, in frames per second JOINTS # The number of 3DO nodes that are to be animated |
MARKERS 2 16.000000 9 112.000000 8 |
This section is only present in some KEY files, and has an unknown purpose.
NODES N |
N is the number of nodes that are animated in this sequence. Note: This number is usually equal to the number of nodes in the 3DO (each part moves, or, at least has an entry).
A Node has a simple header:
NODE # The index of this node MESH NAME # The name of the Hierarchy node in the 3DO that it transforms ENTRIES # The number of entries this node has |
Note: Entries are in fact "waypoints" of sorts, and each entry does not actually represent a single frame of the animation. The game engine interpolates values to create additional frames of animation between two entries, to make the animations smoother.
The header is followed by the entries. Each entry consists of these parts:
num The index of this entry frame The number of the frame which this entry defines flags 32-bit value specifying the properties of this frame 0x0001 = position (x,y,z) changes between current frame and next 0x0002 = orientation (P,Y,R) changes between current frame and next x, y, z Spatial coordinates by which to offset the Node p, y, r Orientation (Pitch, Yaw and Roll) of node dx, dy, dz Change in x / y / z value between current frame and the next dp, dy, dr Change in pitch / yaw / roll between current frame and the next |
Note: if frame definitions are skipped, the 'delta' values (dx, dy etc.) of the last entry are retained until the next frame is reached. See the example below :
#num: frame flags x ... # dx ... 0: 0 0x0003 0.00 ... 0.25 1: 5 0x0003 1.25 0.40 2: 6 0x0003 1.65 0.55 ... |
Frames 1 - 4 are not defined, so the dx value of 0.25 (from frame 0) will be retained until frame 5. i.e. the 3D object's X offset will move through 0.25, 0.50, 0.75 and 1.00 in frames 1 - 4.
0x00 Looping 0x14 Stops at last frame until another event occurs 0x2c Stops after reaching last frame |