A 2D physics simulator that models elastic and inelastic collisions between multiple particles with real-time visualization. Perfect for demonstrating fundamental physics principles and computational physics implementations.
Elastic Collision:
Totally Inelastic Collision of 3 Particles at an Angle:
- Dual Collision Models
π Full support for both perfectly elastic and inelastic collisions - Multi-Particle System
π Simulate any number of particles with customizable properties - Real-time Visualization
π Built with Pygame for smooth graphical representation - Physics-Accurate
π Implements conservation of momentum and kinetic energy principles - Customizable Parameters
π Adjust mass, velocity, restitution coefficients, and more - Optimized Performance
π Efficient collision detection algorithms for smooth operation
- Clone the repository
git clone https://github.com/SulkBash/Collision-Simulator.git
cd Collision-Simulator- Install dependencies
cd Collision_Sim
pip install -r requirements.txt- Run the simulation
python collision.pyThe force is only applied perpendicular to the plane of collision, so the tangential velocity remains unchanged (no force = no acceleration)
The unit vector in the normal direction of the collision is:
Where r1 and r2 are the position vectors of each particle. Then, by the Impulse-Momentum theorem:
Combining all these equations one can solve for the:
Please observe that when e = 1 (elastic collision), you arrive at the well known equations for the final velocites after an elastic collision
- Python 3.8+
- Pygame
- NumPy
- Fork the Repository
- Create your feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add some amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
Distributed under the MIT License. See for more information.

