Flies are one of the most common and annoying pests that can invade our homes. Food, garbage and other organic matter can attract these creatures, transmit disease and contaminate our surfaces. Moreover very fast response times and because they have a good sense of movement, they are also very difficult to catch.
But despite their agility and speed, flies often struggle to get out of a confined space. Even if there is an open window right next to the flies buzzing around a closed window and head banging you noticed. Why are they doing this? Are they stupid, blind or just stubborn?
First we need to understand: how do houseflies see colors and polarization?

Three types of color receptors in your eyes (red, green and blue) found it unlike humans, only two color receptors in the eyes of flies (blue and green) has. This means that they cannot distinguish certain colors such as yellow and white. But they can see ultraviolet light, which humans cannot.
Ultraviolet light is often used by flowers to attract pollen and by other insects to communicate with each other. Flies search for food sources and evade predators that can camouflage themselves in visible light. ultraviolet vision applications.
Another feature of flight vision that people miss is is the ability to detect polarized light. polarized light, such as sunlight reflecting off water or glass It is light that vibrates in a certain direction.
to fly, can feel the polarization angle and they can use it to find direction and orient themselves. For example, they can use polarized light to find water sources or avoid flying into cobwebs.
Let’s come to our question, why do flies keep their heads on the glass?

Despite their advanced vision systems, flies have some limitations that make them vulnerable to windows. One of these limits is lack of depth perception. Because their eyes are on their heads and they cannot move on their own, they are not very good at judging distances.
Significant change in position of an object as it passes by, to estimate how far away something is motion parallax they trust. However, with this method, the object cannot be close or when it is stopped it’s not very true.

Another limitation is their inability to adjust focus or pupil size. Unlike human eyes, which have a single deformable lens and a pupil that can expand or contract to control the amount of light entering the eye, fly eyes have fixed lenses and no pupils.
This means that they cannot adapt to different lighting conditions or inability to focus on different objects resources. They can only see clearly at a certain distance and brightness level.
These restrictions are; makes it difficult for houseflies to perceive windows as solid barriers. reflection of light and by polarization they can mix them with open spaces or water sources.
They may also not notice the window frame or open window next to it because their depth perception and focus are poor. Finally, until they exhaust themselves or find another way out they may continue to crash into the glass or fly off the edge of the window.
There are some simple things you can do if you want to get the flies out of your house without hurting yourself or yourself.

The first option is the window cover with a dark cloth or paperwhich block the light and reduce the interest of the flies.
Another option is to open another window or door on the other side of the room to keep the flies away. a crosswind to lead to the exit will make. You can also try using a soft vacuum cleaner or soft brush to gently catch and release flies outdoors.
actually fly They are not as stupid as they seem. They have an extraordinary vision system that allows them to survive in a complex and dynamic environment. However, their vision also has some drawbacks that make them susceptible to being caught on windows.
By understanding how houseflies see the world and why they act, we can appreciate and appreciate their fascinating biology. We can live more peacefully with them.
Sources: School of Bugs, Quora, Reddit, Hunker