I'm new with pymunk and I would like to implement a n-body simulation (in 2D) like this one: https://www.youtube.com/watch?v=otIGNTFJwpU&feature=youtu.be
I already know how to create the space, shapes and the rendering with pygame. My question: is there a way to add gravitation forces between shapes in pymunk?
Thanks for your help.
There is no built in way to do it directly in pymunk. The easiest is probably to calculate it yourself. Loop the bodies and for each body make a space query to find nearby bodies. Calculate the resulting gravity and use apply impulse.
(Possibly its possible to emualte with one of the constraints, for example the pin joint or damped spring.. but that will require some thinking and experimenting to find out if its possible and looks good)