ghost=FireProjectile(player, ghost_template, -1, -1, '0 0 0', '0 0 0', 0, 0, 0, 0); lvec=GetThingLVec(ghost); DestroyThing(ghost);Now the vector, lvec, holds the lookvector of the player with headpitch taken into account.
Instead of destroying the ghost through cog, you can put a timer in its template to remove it from the game after a short delay.
Many cog editors used to think that the z axis of a lookvector returned by GetThingLVec() did not work. Remember that headpitch only affects the upper half of the player, while an lvec is the direction that his whole body is looking.