Perception, motion and coordination in animal groups