Behavioural mechanisms behind aggregation in a tritrophic perspective