ANTI-AIRCRAFT GUNS

Anti-aircraft (AA) guns are an important part of any air combat simulation. Creating AA guns involves several steps: (1) creating an animated gun model; (2) creating animated tracer bullets; (3) creating gunfire animations and sound; and (4) creating explosion animations and sound.

THE ANIMATED GUN MODEL

We used Blender to create a model of a WWI AA gun. The gun includes several parts, the most important of which are the base and the barrel. The center of the barrel is located where the barrel is connected to the base.

Only only animation required for the barrel is along the X-axis (latitude). Following our normal practice, the animation range is 0 to 360, with 180 as the center position, 90 is straight up and 270 is straight down. We compute the latitude required in the program, ranging from 90 (straight up) to 270 (straight down). We can use these values directly in the animation.

The program also compute the longitude required in the program. This value is used to rotate the entire gun object to point towards the target.

THE BULLETS

For each gun, we create several tracer bullets, in case there are more than one in the air at the same time. This is similar to what we do for aircraft bullets. If the gun is firing slow enough, each bullet can be a "tracer". The program must perform the following tasks: (1) Fire the bullets at the appropriate interval, (2) For each frame, compute position and rotation for all active bullets, (3) End the bullet after an approptiate time, or at the appropriate altitude.

GUNFIRE ANIMATIONS AND SOUND
Firing a gun will generally cause fire and smoke to emit from the barrel along with the sound of a gunshot. We are using a simplified visual with a red line protuding from the gun which is only visible for 1/10 of a second when the gun is fired. The sound effect can either be a single sound triggered when the bullet is fired, or a repeating sound that runs independent of actual shots fired. We are using a using a single sound.
EXPLOSION ANIMATIONS AND SOUND
When the bullet ends, there will be smoke and the sound of an explosion. We are using a single smoke sprite for the smoke. This sprite is placed where the bullet ended and disappears over time. The sound is a single sound triggered at the same time.