Aiming a turret (Math question)

Is this the behavior you’re looking for?