I sort of cheated in The Black Gap... I didn't actually target the rocket, but switched the cam from the Shooter to the Tank he was shooting at
As a result it looked like it was following the flight path of the rocket...
However in the Loose outro in Facile Ground I targeted an AT rocket. Here's the code I used:
_now = (time + 7)
#OLatguyloop
~0.01
atguy dofire ftruck
? (atguy ammo "AT4Launcher" == 1) and (alive atguy) and (time < _now): goto "OLatguyloop"
_at4 = (nearestobject [atguy,"AT4"])
setacctime 0.05
~0.2
_cam camsetpos [(getpos _at4 select 0) + sin (getdir _at4 + 5) * 20, (getpos _at4 select 1) + cos (getdir _at4 + 5) * 20, 1]
_cam camsettarget _at4
_cam camcommit 0
First off... ignore the camsetpos line.
What you're interested in is the _at4 = (nearestobject... line. Once you assign the rocket to a variable, you can target it just like anything else.
You need to grab it pretty much as soon as it's fired, because nearestobject only has a range of 50m. Hence the loop detecting when his ammo is 0 (ie he's got no ammo because he's fired).
Also, be aware that to get the camera shot to work (ie. look good) you need to use slow motion. Not necessarily as slow as I have here, but definitely much slower than usual.
A possibly more reliable method is to use the fired eventhandler, as that may work quicker than the dodgey loop I've got up there. Anyway, up to you