Maggots can die in the sun due to heat and light. The process is called desiccation, which is the loss of water from an organism. They are susceptible to dehydration and can dry out if exposed to direct sunlight for too long. It is also possible for them to die from being cooked alive in direct sunlight.