Gravity Simulation with Python

preview_player
Показать описание
Simple physical simulation with Python and Pygame produce for learning purposes.

At each step the forces exerted on a particle due to the mass of all the rest of particles are calculated, the resultant force is used to compute the acceleration of the particle, its new velocity and its new location.

The orange particle represent an object with a mass considerable bigger than the rest and a fixed location. This tries to represent a star (orange particle) surrounded by planets and asteroids (rest of particles).
Рекомендации по теме
Комментарии
Автор

I like this very much! :D would you mind sharing the code? I would love to see how you did this :)

quentinwach
Автор

This is super cool! How did you calculate the result of collisions? Bit surprised to see the 'planet' at the 4:45 get stopped dead in its tracks after being hit by a small 'asteroid'.

WilliamRussell
join shbcf.ru