Skip to content

Sangeet96/GravityBalls_OpenGL_ComputerGraphics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Gravity Balls 🎱🌌

Gravity Balls is a physics-based 3D simulation project built using OpenGL and GLUT, where multiple balls move under the influence of gravity, friction, and collision dynamics. This project is a fun and interactive way to visualize basic physics in action using graphical rendering.


🧠 Features

  • βœ… Realistic gravity-based motion simulation
  • βœ… Collision detection and response between balls
  • βœ… Boundary collisions with wall rebound effects
  • βœ… Frictional slowdown to simulate energy loss
  • βœ… Rendered using glutSolidSphere in a 3D space

πŸ› οΈ Tech Stack

  • Language: C++
  • Graphics: OpenGL, GLUT
  • Platform: Windows Visual Studio 2022 (VS Solution File included)


πŸš€ How to Use

πŸ”Ή Build from Source (Using Visual Studio)

  1. Download all the files on your computer.
  2. Open GravityBalls.sln in Visual Studio.
  3. Make sure your system has OpenGL and GLUT libraries set up (Visual Studio should handle this if you're using the included files).
  4. Press Ctrl + F5 to build and run.

❓ Controls

The simulation starts automatically, but you can interact and modify parameters in real time using the following keyboard shortcuts:

Key Action
2 / 8 Decrease / Increase Gravity
4 / 6 Decrease / Increase Friction
A / D Decrease / Increase Elasticity
Q / E Decrease / Increase Entropy
< / > Decrease / Increase Time Scale
N Add New Balls
M Toggle Magnetize Walls
B Toggle Black Hole Mode
G Toggle Cursor Gravity
+ / - Zoom In/Out
SPACE Pause/Play
R Reset
C Clear
ESC Quit
(Shown on top of simulation window) Real-time updated values: Gravity, Friction, Elasticity, Ball Count, Entropy, Time Scale, etc.

You can also customize the number of balls and initial settings directly in main.cpp before compiling.

πŸ§ͺ Feel free to experiment with combinations to see how the environment reacts!


πŸ“œ License

This project is for educational purposes and open to contributions.
Feel free to fork and modify it!


πŸ‘¨β€πŸ’» Developers

Samdeep Sharma
Final Year CSE Student at Thapar Institute
LinkedIn

Sangeet Kumar
Final Year CSE Student at Thapar Institute
LinkedIn


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages