"I read that Uranus got its tilt when it was hit by another object. What does it mean for a ball of gas to be hit -- wouldn't another object just pass through it?"
NASA, ESA, L. Sromovsky and P. Fry (University of Wisconsin), H. Hammel (Space Science Institute), and K. Rages (SETI Institute)
There's no hope of sailing straight through Uranus, despite its gaseous composition.
The outer planets Jupiter, Saturn, Uranus, and Neptune are composed mostly of materials that are gases or liquids at standard temperature and pressure -- things like hydrogen, helium, water, methane, and ammonia. And the parts of those worlds that we can see, their uppermost atmospheres, are in the gaseous state.
But if you took a ride in a space probe that could dive into a giant planet atmosphere, it wouldn't take long before the state of things would change, because of a rapid rise in both temperature and pressure. The interiors of the giant planets behave mostly like liquids, and deep within them they actually have cores made of rock and metal, the same stuff Earth is made of.
In the early solar system, there were frequent collisions between the protoplanets and other nearly planet-sized bodies called planetesimals. A colliding planetesimal certainly couldn't fly straight through the incredibly dense liquidy interior of a protoplanet, so it was absorbed. When that happened, the planetesimal contributed not only its mass but also its momentum to the growing planet. If the impact happened off-center, and statistics says that it's much more likely for an impact to be off- than on-center, the collision could have spun the protoplanet faster, or counteracted its spin, and it could also have shifted its rotation axis. Such collisions most likely explain the sideways spin of Uranus as well as the slow, backward spin of Venus.