Scientists say they have solved the mystery of how archer fish can spit powerful jets of water to capture prey.