Studied here is the problem of multiple unmanned aerial vehicles flying in formation in an environment containing many obstacles and threats. Two schemes are proposed for avoiding obstacles: formation dissolution and formation change. The improved interfered fluid dynamical system approach is used to guide the unmanned aerial vehicles to their destination safely, and an artificial potential field is used for formation forming and re-forming and to avoid intervehicle collisions. Straightforward and effective control algorithms are designed for the two schemes. Unlike other algorithms, the proposed method can be applied to different scenarios with no additional requirements, such as having to have different controllers for different situations. Finally, two simulation experiments are provided to validate the effectiveness of the proposed control algorithms.