Text this: Integrating physics and topology in neural networks for learning rigid body dynamics