Behavioral dynamics of avoiding a moving obstacle