It’s a counterbalance.
When we bipedal humans walk, we swing the opposite arm to forward and the adjacent arm backward with each step so as to counterbalance the shifts in momentum created by taking that step and not lose our balance and fall over.
Birds are also bipedal, but they avoid swinging their wings around when they are on the ground, rather they keep their wings tucked up behind their backs to protect them. So instead they use their heads to counterbalance each step instead.
In addition to u/TheSeethingSea’s comment.
It’s the issue with moving and seeing at the same time. Humans have the ability to move our eyes independently from our head. So as we walk around we unconsciously move our eyes around to keep focused on what we’re seeing while our body is moving. Birds lack the ability to move their eyes so they can’t do this, and their vision would be all messed up as they move.
So they keep their head “floating” sort of like how a steady-cam works in movies. Their bodies move around and their head stays in place and they suddenly jerk their head forward into a new location. This way they can keep focused on what they’re looking at while they move.
A walking pigeon makes him more vulrebable than a pigeon that flies. So when the pigeon walks he has to be extra carful and watch his surrounding.
So when a pigeon moves, his head stays on the same place. The reason for this is, while he doesn’t move his head, he can observe his surrounding better.
If you pick up a pigeon and moves him in your hand, he still will moves his head.
Latest Answers