The motion control problem of UAVs flock moving through obstacle field towards a target point in quasi-two-dimensional space is considered. An approach is suggested, according to which the grid with cells of the selected size is imposed on the mission area. At the same time, the obstacle is interpolated by the set of convex polygons constructed on the nodes of this grid. The algorithm for determining the desired speed of objects in a group based on swarm robotics principles is proposed. The results of the simulation modeling are presented.