Gravity Physics Simulation

I made custom gravity physics that can be time warped!

robloxapp-20220702-2012302.wmv (4.0 MB)

Basically, there are three properties in a body:

  • Mass
  • Velocity
  • Pull

Together, these values affect the simulation differently.

Mass is the strength of the gravity and inertia of a body
Velocity is the speed of the body because I switched from LinearVelocity to moving the position of the part in the script because it gave more accurate results
Pull is the total force of gravity of all the other planets in the simulation on a body

And with each RunService heartbeat, it calculates the next position of a body with all the three variables and moves it accordingly which I can multiply with a number to change the time scale.

I wonder if I could make the planets collide and have cool explosions :thinking:

what do you think?

4 Likes

Welp the earth gets yeeted to the cosmos. I guess its good. but not scientifically accurate.