- Requires
SFML 2.5.1 - Particles are handled by using
sf::VertexArray - Using the Particle class constructor, you can pass how many particles you would like to spawn.
- Change the starting positions of particles in the
Particle::SetPosition()function withinParticle.cpp - Each body acts as a gravity source. Place it in position and tweak its strength using the default constructor.
- Particles do not apply gravitational force upon each other. The bodies also do not attract each other.
- This does not fully apply Newtons law of universal gravitation. Bodies act as a static particle attractor.
- The strength of gravitational pull is inversely proportional to the square of the distance between particle and body.
- Each particle obtains a vector that reflects the gravitational acceleration to the nearer (or stronger) body.
- Look at
Particle.cppto see the implementation.
particles_demo.mp4
- This project could use better optimization, however this was more of a learning project for me. So if you would like to contribute, I will accept pull requests.