Gravity Simulator is a 3D simulation built with Three.js and CANNON.js, providing a visual and interactive experience of gravity and physics in a simulated environment. Users can manipulate various elements such as the number of spheres, gravity constants, and velocities to observe different gravitational effects.
- Dynamic 3D rendering using Three.js.
- Realistic physics simulation with CANNON.js.
- Interactive GUI with dat.GUI for real-time parameter adjustments.
- Customizable lighting and shadows for a more immersive experience.
- Effects composer with SSAO for enhanced visual depth.
- throw rocks or collection of rocks by clicking around the screen. Try to make a stable orbit!
Collapsing rocks | Two systems orbiting each other |
Follow these steps to set up the simulation locally:
-
Clone the repository:
git clone https://github.com/JMMonte/gravity_sim.git
-
Navigate to the project directory:
cd gravity_sim
-
Install the necessary dependencies:
npm install
-
Launch the development server:
npm run start
The simulation should now be available at http://localhost:8080.
To create a production build, execute:
npm run build
This generates a dist
folder containing the optimized assets ready for deployment.
After building for production, deploy by uploading the contents of the dist
folder to your server's root directory. Ensure the server serves index.html
as the entry point.
Contributions to Gravity Simulator are welcome! To contribute, please fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.