Many marine and terrestrial species live in groups, whose sizes and dynamics can vary depending on the
type and strength of their social interactions. Typical examples of such groups in vertebrates are schools
of fish or flocks of bird. Natural habitats can encompass a wide range of spatial heterogeneities, which can
also shape the structure of animal groups, depending on the interplay between the attraction/repulsion of
environmental cues and social interactions. A key issue in modern applied ecology and conservation is
the need to understand the relationship between these ethological and ecological scales in order to
account for the social behaviour of animals in their natural environments. Here, we introduce a modeling
approach which studies animal groups within heterogeneous habitats constituted by a set of aggregative
sites. The model properties are investigated considering the case study of tropical tuna schools and their
associative behavior with floating objects, a question of global concern, given the thousands of floating
objects deployed by industrial tropical tuna fisheries worldwide. The effects of increasing numbers of
aggregative sites (floating objects) on tuna schools are studied. This study offers a general modeling
framework to study social species in their habitats, accounting for both ethological and ecological drivers
of animal group dynamics.