This paper deals with the scenario of two multi- UAV systems (so-called teams), each flying from a starting point to a target point. The teams meet on their ways and have to avoid collisions in the horizontal plane. Both teams work independent of each other but use the same formationcontrol and obstacle-collision-avoidance algorithm. The leaders measure obstacles' positions, use a Kalman Filter to estimate their movement and predict their future positions. With the information about the other agents' positions each agent calculates its reference trajectory. The leader also computes a trajectory to guide the team towards the target point. Distributed MPC is used for each agent to track its reference trajectory. If there is a risk of colliding with an obstacle, the MPC cost function is extended by a penalty term to ensure obstacle collision avoidance. The stability of formation control is proved in this paper. The capability of two teams avoiding collisions is shown in a simulation.