3. Positioning Your Animation

Each state handles a particular cycle of animation. It is important that you position the frames of your animation properly in each cycle otherwise you will get strange effects (such as the player swimming above the surface of the water or ducking into the ground). Different animation states (such as duck and swim) follow different sets of rules as far as it's proper positioning goes. I will go through each state here using the "cwarrior.mdl" model from the Geo-Metricks Models Pack as an example.

The first frame of the model is important because it sets up the model's bounding box values (min and max x, y, and z values). Unless you manual change the bounding box in your code, this is the box that will be used to handle all collision. The bounding box also determines the default hull the model uses for collision with map elements, like buildings. You can read details about hulls and collision detection in the C-Script manual - for the moment it is sufficient that you know that the hull is a fixed size box, usually smaller than the model, around the model's origin. The origin is the small cross you see in MED. Because the hull can never penetrate a solid map element, the model's origin must always be located near the center of the model.

Next