The paper concerns optimal control of discontinuous differential inclusions of the normal cone type governed by a generalized version of the Moreau sweeping process with control functions acting in both nonconvex moving sets and additive perturbations. This is a new class of optimal control problems in comparison with previously considered counterparts where the controlled sweeping sets are described by convex polyhedra. Besides a theoretical interest, a major motivation for our study of such challenging optimal control problems with intrinsic state constraints comes from the application to the crowd motion model in a practically adequate planar setting with nonconvex but prox-regular sweeping sets. Based on a constructive discrete approximation approach and advanced tools of first-order and second-order variational analysis and generalized differentiation, we establish the strong convergence of discrete optimal solutions and derive a complete set of necessary optimality conditions for discrete-time and continuous-time sweeping control systems that are expressed entirely via the problem data. © 2018 Elsevier Inc.