Skip to content

manavkulshrestha/GravitySim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gravity Simulator

Semi realistic gravity simulator using real physics equations for my AP CS Final Project.

Force of gravity between multiple objects is calculated using Fg = (G * m1 * m2)/r^2.

When two or more objects get too close, they collide and combine to form a bigger object and momentum is preserved. m1v1 + m2v2 = (m1+m2)*v’

Instructions:

Run the main function in "GravitySimulator"

All text fields take in integers. Play around with it to see what works well and allows you to achieve a stable orbit. Click anywhere on the “Gravity Simulator” to capture coordinates of the point and click “Pull Coordinates” to use them. Once you’re satisfied with your settings, click “Place” to place the body.

Game:

Try to see how many bodies you can get to maintain a stable orbit around a body at (550, 300) of mass 499.

Goal for the future:

Create a designated level maker and an official way to keep track of orbits as the game progresses. Potential scoring system.

About

AP CS Final Project. The idea is to create a program that simulates gravitational interactions between n bodies in 2 dimensions. Possibly implement a game using these mechanics as an end goal.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages