The purpose of the euglena's eye spot is: