586159 An arrangement for determining positions of the teats of a milking animal (8) in a rotary milking system (3) is disclosed. The arrangement includes a milking stall (5) for housing the animal during milking, a movable robot arm (15) for automatically attaching teat cups (11) to the teats of the animal, and a control device (14) for controlling the movement of the robot arm based on determined positions of the teats of the animal. The arrangement also includes a three-dimensional camera (21) provided to repeatedly record three- dimensional images of the udder of the animal in real time and image processing means (22) provided for repeatedly detecting the teats of the animal and determining their positions based on the repeatedly recorded three-dimensional images. During the recordings of the three-dimensional images, the three- dimensional camera is located at a fix position with respect to a floor or ground, on which the rotary milking system is installed and with respect to which a rotary platform of the rotary milking system rotates.