Universal Gravitation Simulation

As a person who has always used the base Roblox physics mechanics for their games, I though it’d be interesting to see what I could do with custom physics.

Using Newton’s equation (

) the game applies forces to parts with a workspace gravity of 0.

I managed to create a temporary orbit by applying a bit of initial velocity to two parts, and by placing a larger part at the center. True orbit is technically possible, but I haven’t done the calculations to actually pull it off.

n3bpIfs9Tr 5sxgLIJKdV

I’ve even created a situation in which one body crashes into another body, which eventually stabilizes into a sort of orbit given some time.

With the example place, it spawns random bodies which can create other cool effects.


Although not 100% accurate to real-world physics, it does come relatively close to a planetary effect.

This little demo is open source in case you want to try it out for yourself or just look around.


This is absolutely awesome, my man.
Are you also able to make the mass and density of a planet alterable in conjunction with gravitational pull?
Also, how much does this lag, if there is any in the first place?
Is this all zero-gravity, even for players?

1 Like

You are able to change the mass and density as this simulation relies on base Roblox physics. By customizing the part’s CustomPhysicalProperties you can increase the density and mass.

This doesn’t lag very much for me, but it can if there are too many other parts around as it creates a Force instance for every object in every object.

Yes this is all zero gravity - even for players, however currently the script only handles baseparts, though I am working on a way to do it with models.


Sorry for bumping and I know it’s been five months but is there any possible ways to make it slower?

1 Like

You can slow it down by multiplying the force equation (locate where it multiplies the masses then divided by distance squared) by a smaller number. Realistically you would use the universal gravitation constant G (6.67 x 10-11 Nm^2kg^-2) but I believe in the simulation I actually speed it up.

If you want to just have it slowed down by a certain amount, just change the G in the equation to something less than what it currently is.

1 Like