Myxobacterial cells are social; they swarm by gliding on surfaces as they feed cooperatively. When they sense starvation, tens of thousands of cells change their movement pattern from outward spreading to inward concentration and form aggregates that become fruiting bodies. Cells inside fruiting bodies differentiate into round, nonmotile, environmentally resistant spores. Traditionally, cell aggregation has been considered to imply chemotaxis, a long-range cell interaction that shares many features of chemical reaction\u2013diffusion dynamics. The biological evidence, however, suggests that Myxococcus xanthus aggregation is the consequence of direct cell-contact interactions that are different from chemotaxis. To test whether local interactions suffice to explain the formation of fruiting bodies and the differentiation of spores within them, we have simulated the process. In this article, we present a unified 3D model that reproduces in one continuous simulation all the stages of fruiting-body formation that have been experimentally observed: nonsymmetric initial aggregates (traffic jams), streams, formation of toroidal aggregates, hemispherical 3D mounds, and finally sporulation within the fruiting body.