For a number of applications, this issue is often solved by using a dedicated PTZ Camera, which has a camera with a zoom lens integrated with a motor-driven and controllable pan+tilt head. Most of these cameras nowadays are also IP cameras that can be controlled via network or IoT standard interfaces.
In surveillance, these cameras are often mounted upside down from a ceiling, some distance away from the target area to be monitored. This reduces the maximum sweep angle needed to adjust for the height of the individual entering the surveillance zone, and also avoids a potential issue where the PTZ might not be able to look down at a subject (the way standing adults address children) if it were mounted right-side-up, as the sweep area for the tilt is typically from parallel to the base to straight up.