Antiglare device for vehicles, comprising a retractable sunvisor, a sun sensor and a control unit; the retractable sunvisor comprising: - a sunvisor screen (1.1) being configured to move according to a sliding movement between a stowed position, in which the sunvisor screen (1.1) is inside a space formed between a headliner and a roof sheet, several intermediate positions, in which the sunvisor screen (1.1) is partially outside the space formed between the headliner and the roof sheet up to a final intermediate position in which the sunvisor screen (1.1) is totally outside such space, and several frontal use positions according to a rotating movement of the sunvisor screen (1.1) regarding a windshield, in any position of the sunvisor screen (1.1) a vehicle occupant can be protected from the glare of sun light coming through the windshield; - a movement mechanism (1.2) being configured to provide the sliding movement and the rotating movement of the sunvisor screen (1.1); the sun sensor comprising one to sixteen photosensors or light detectors (2.1) being configured to measure the light incident angle and light intensity; the control unit being connected to the movement mechanism (1.2) and to the sun sensor, including a sunvisor edge path, an initial vehicle occupant eyes position, a light intensity threshold and a light incident angle range, and being configured to calculate the edge position of the sunvisor screen (1.1) by intersection of the sunvisor edge path and a line parallel to sun light passing through the initial vehicle occupant eyes position, and also being configured to send the sliding movement and/or the rotating movement of the sunvisor screen (1.1) to the movement mechanism (1.2) to reach the edge position when the light intensity is over the threshold and the light incident angle is within the light incident angle range; wherein the sun sensor is a unique part, the control unit also includes a margin area of the initial vehicle occupant eyes position projected downwards from said position, the antiglare device also comprises an acceleration sensor, comprising one to three accelerometers, being configured to measure the vehicle movement in the three axis X,Y,Z; the control unit being connected to the acceleration sensor and being configured to receive and process directly the vehicle movement from the acceleration sensor; in such a way that the control unit is able to take into account both the measurements of light incident angle and light intensity from the sun sensor and the measurement of vehicle movement from the acceleration sensor to send the sliding movement and/or the rotating movement of the sunvisor screen (1.1) to the movement mechanism (1.2) to reach the edge position. - a sunvisor screen (1.1) being configured to move according to a sliding movement between a stowed position, in which the sunvisor screen (1.1) is inside a space formed between a headliner and a roof sheet, several intermediate positions, in which the sunvisor screen (1.1) is partially outside the space formed between the headliner and the roof sheet up to a final intermediate position in which the sunvisor screen (1.1) is totally outside such space, and several frontal use positions according to a rotating movement of the sunvisor screen (1.1) regarding a windshield, in any position of the sunvisor screen (1.1) a vehicle occupant can be protected from the glare of sun light coming through the windshield; - a movement mechanism (1.2) being configured to provide the sliding movement and the rotating movement of the sunvisor screen (1.1); the sun sensor comprising one to sixteen photosensors or light detectors (2.1) being configured to measure the light incident angle and light intensity; the control unit being connected to the movement mechanism (1.2) and to the sun sensor, including a sunvisor edge path, an initial vehicle occupant eyes position, a light intensity threshold and a light incident angle range, and being configured to calculate the edge position of the sunvisor screen (1.1) by intersection of the sunvisor edge path and a line parallel to sun light passing through the initial vehicle occupant eyes position, and also being configured to send the sliding movement and/or the rotating movement of the sunvisor screen (1.1) to the movement mechanism (1.2) to reach the edge position when the light intensity is over the threshold and the light incident angle is within the light incident angle range; wherein the sun sensor is a unique part, the control unit also includes a margin area of the initial vehicle occupant eyes position projected downwards from said position, the antiglare device also comprises an acceleration sensor, comprising one to three accelerometers, being configured to measure the vehicle movement in the three axis X,Y,Z; the control unit being connected to the acceleration sensor and being configured to receive and process directly the vehicle movement from the acceleration sensor; in such a way that the control unit is able to take into account both the measurements of light incident angle and light intensity from the sun sensor and the measurement of vehicle movement from the acceleration sensor to send the sliding movement and/or the rotating movement of the sunvisor screen (1.1) to the movement mechanism (1.2) to reach the edge position.