Hummingbirds have a unique collision avoidance system built into their brains that allows them to perform high-speed aerobatics in safety, research has shown.
The super-agile birds, whose wings beat up to 70 times a second, can hover, fly backwards, and whizz through dense vegetation at more than 50kph (30mph).
How they manage to avoid potentially fatal crashes has remained a mystery until now.
Scientists in Canada conducted a series of experiments which showed that the little birds process visual information differently from other animals.
As they dart and dive at speed, they judge distance from the way looming objects appear to get bigger, and vice versa.
Other animals, from bees to human motorists, calculate distances from the rate at which objects cross their field of vision.
Hence, a car driver can tell that telephone poles are near because they pass by swiftly. Conversely, far away buildings take more time to move across the visual field, giving an impression of distance.
For this reason, it is difficult to judge the closing speed of an object you are approaching head-on - a lesson taught to all aircraft pilots.
Lead researcher Dr Roslyn Dakin, from the University of British Columbia's department of zoology, said: "Birds fly faster than insects and it's more dangerous if they collide with things. We wanted to know how they avoid collisions and we found that hummingbirds use their environment differently than insects to steer a precise course."
To study the hummingbirds, the scientists placed the birds in a specially designed tunnel and projected striped grid patterns on the walls to simulate near, distant and moving objects.
A perch was set up at one end of the tunnel and a sugar water feeder at the other. Eight cameras tracked the birds' movements as they flew to-and-fro along the 5.5m (18ft) tunnel.
When the scientists simulated the "telegraph poles effect" with vertical moving stripes, the hummingbirds did not react. Instead, they appeared to rely on the size of objects to determine distance, steering away from the stripes as they grew larger.
"When objects grow in size, it can indicate how much time there is until they collide even without knowing the actual size of the object," said Dr Dakin. "Perhaps this strategy allows birds to more precisely avoid collisions over the very wide range of flight speeds they use."
The study, published in the journal Proceedings of the National Academy of Sciences, also showed that hummingbirds use a similar technique as flies to gauge altitude.
In this case, they did respond to vertical movement up and down across the visual field.