An arrangement, which is provided for determining the position of an animal, comprises a three-dimensional camera directed towards the animal and provided to record a three-dimensional image of the animal, and image processing means is provided for detecting the animal and determining its position in at least one spatial dimension based on the three-dimensional image of the animal. The image processing means may form a three-dimensional surface representation of a portion of the animal from the three-dimensional image of the animal, analyze the surface of the three-dimensional surface representation, and determine the position of the animal based on the analysis of the surface of the three-dimensional surface representation.