https://github.com/ultraflame4/gravsim
A simple n-body gravity simulation with balls
https://github.com/ultraflame4/gravsim
Last synced: 12 months ago
JSON representation
A simple n-body gravity simulation with balls
- Host: GitHub
- URL: https://github.com/ultraflame4/gravsim
- Owner: ultraflame4
- Created: 2023-10-20T12:14:07.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-12T03:44:48.000Z (over 2 years ago)
- Last Synced: 2025-02-28T11:45:51.640Z (over 1 year ago)
- Language: C++
- Size: 275 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GravSim [WIP]
Gravity simulation for circular objects using [Newton's law of universal gravitation](https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation)
and some other physics formulas
https://github.com/ultraflame4/GravSim/assets/34125174/11dfd9a1-0f8b-4d17-b473-81c1e6b61f97

## Downloads
Get latest release from [releases](https://github.com/ultraflame4/GravSim/releases).
You can also install from itch.io https://notlivingstudios.itch.io/gravsim
## Controls
[Space] - Pause
[W] - Move camera up
[A] - Move camera left
[S] - Move camera down
[D] - Move camera right
[Right Click + drag] Spawn object with velocity ( velocity depends on direction and distance of drag)
## Building
### Prerequisites
To build this project, you will need:
1. clang or a compiler with C++23 support (eg. clang)
2. cmake version 3.26 and above
3. ninja (or any other cmake supported build system)
### Instructions
The following instructions will assume you are using `ninja` as your build system
1. First install ninja. See [here](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages) for instructions
2. Secondly clone this repository and its submodules:
```shell
git clone https://github.com/ultraflame4/GravSim.git --recursive --depth=1
```
2. Use cmake to generate project build files.
```shell
cmake -S . -B build -G Ninja
```
3. Build the project with.
```shell
cmake --build build
```
4. Run the executable `GravSim.exe` in the build folder
## Notes:
1. The collision physics is very buggy.
~~2. Spawning too many bodies will make them disappear. I have no idea why.~~ fixed