You are browsing as a guest. Sign up (or log in) to start making projects!

Open comments for this post

3h 5m 59s logged

Devlog #1: GraSim v0
first version of GraSim! a fun, addicting gravity simulator!

v0 includes a few basic features, including asteroids, planets/stars, collision/no collision modes, gravity field mode (you can see the gravity fields), and panning mode (infinite map style).

raylib is the easiest for these kinds of things in c++, so i used that as the main library. the majority of the code was just physics, mainly Softened Newtonian Gravity:

F = G·m₁·m₂ / (d² + ε²)

and various other smaller things during collisions, collisions during no-collision mode, etcetera

i’m not sure what the end result will be like, maybe i’ll add more realistic-looking planets and asteroids, and maybe black holes & white holes.

here’s the main part:
static void AddBody( vector<Body>& bodies, Vector2 position, Vector2 velocity, float mass, Color color ) { Body body; body.position = position; body.velocity = velocity; body.mass = mass; body.radius = RadiusFromMass(mass); body.color = color; bodies.push_back(body); }

i’m not sure what the final goal is, but I hope it’s cool!

0
1

Comments 0

No comments yet. Be the first!