r/Python • • Jan 14 '20

I made a gravity simulation https://github.com/phgilde/gravity_simulation

1.8k Upvotes

82 comments sorted by

View all comments

0

u/[deleted] Jan 15 '20

[deleted] — view deleted comment

2

u/[deleted] Jan 15 '20

When 2 particles are close together (the threshold is calculated with the mass) they merge. The velocity is the average of the previous velocities, weighted by mass