I think that the 'agent based' approach is good for your purpose. I've already used MASON to play a little with 'a sort of' gravity.
(you will have to know java - easier if you work on top of the examples- and the documentation is very good)
MASON
is a fast discrete-event multiagent simulation library core in Java, designed to be the foundation for large custom-purpose Java simulations, and also to provide more than enough functionality for many lightweight simulation needs. MASON contains both a model library and an optional suite of visualization tools in 2D and 3D.
see the examples:
Bouncing Particles - is a tutorial demo of simple particles bouncing and interacting with one another.
Balls and Bands (Tutorial 5) (mass springs between objects)
simulates Hooke's Law with balls connected by rubber bands of different strengths.
HeatBugs -- shown in wireframe 3D.
you can also explore the BREVE package.
Breve A 3d Simulation Environment for Multi-Agent Simulations and Artificial Life (IA)
objects, joints, gravity.