Obstacle avoidance is a key technology of multiagents flocking control. However, most existing research studies assume that the agent can obtain global information about obstacles and have specific constraints on the shape and boundary of obstacles, which easily limit their practical applications. To relax these constraints, we assume that the agent can only perceive the position of obstacle boundary points within its sensing radius and propose an obstacle boundary point and an expected velocity-based flocking algorithm of multiagents with obstacle avoidance. In this algorithm, the attraction/repulsion potential is designed to avoid collisions between agents and between the agent and obstacle boundary points, the expected velocity is designed to tow the agent to move along the boundary of obstacles, and the virtual leader is designed to lead all agents to realize the group objective. Finally, the sufficient conditions that the agent does not collide are demonstrated, and the performance of the proposed algorithm is further verified through simulations.