Most of the collapsing mass collected in the centre, forming the Sun , while the rest flattened into a protoplanetary disk out of which the planets , moons , asteroids , and other small Solar System bodies formed.