Ever wondered what happens to your bullets when they exit the barrel of your gun? Well in ArmA each projectile is an actual object which is subject to laws of Physics. I just thought it would be interesting to see what would happen if you attach a camera to a projectile from the moment it is fired to the moment it ceased to exist…

When you pull the trigger, a dedicated ArmA event is triggered, which is called “Fired”. It returns an array of information about the shot including the actual object of the projectile, and this is exactly what we need. The script is below, you can either copy paste it in init.sqf or in debug console in editor and execute from there:

player addEventHandler ["Fired", { _null = _this spawn { _missile = _this select 6; _cam = "camera" camCreate (position player); _cam cameraEffect ["External", "Back"]; waitUntil { if (isNull _missile) exitWith {true}; _cam camSetTarget _missile; _cam camSetRelPos [0,-3,0]; _cam camCommit 0; }; sleep 0.4; _cam cameraEffect ["Terminate", "Back"]; camDestroy _cam; }; }];

This is what is happening. First we create an event handler “Fired”, which will execute our code upon firing. We then need to spawn our script as we need to use script suspension and we cannot do it directly inside event handler scope. Then we need to create the actual camera instance and set it to target our projectile from behind at a distance of 3 metres, which will be repeated on each frame.

Projectiles in ArmA get deleted after they hit the ground, explode or their TTL (time to live) gets exceeded. When projectile is deleted the projectile object becomes objNull and this is how we know when to quit waitUntil loop. We can then wait for 0.4 seconds more to see the effect from impact. After that to return back to soldier view we execute “Terminate” effect to exit camera. Now we can safely remove camera by destroying it.

I think it is pretty helpful to visually see in real time how long it takes for different ammo to travel different distances, especially when you have to shoot moving target and have to aim ahead of its movement. A world of warning though. When you place an explosive, “Fired” event will also trigger so you gonna be stuck on cam screen because the explosive will not get deleted by itself. Throwing smoke will also get you stuck on cam screen until the smoke is depleted. “Now if you think that’s unfair, you come and pay me a little visit. But you better be waving a white flag, high and clear so as I can see it. Or it’ll be the last little visit you ever make.” 🙂

Enjoy,
KK