Gravity Calculations, Attractors, and Game Physics.

General physics and astronomy discussions not directly related to Celestia
Topic author
Ice
Posts: 2
Joined: 18.12.2003
With us: 20 years 11 months

Gravity Calculations, Attractors, and Game Physics.

Post #1by Ice » 18.12.2003, 01:00

I'm working on a virtual model of gravity in a text based game simulation (MUD game that will have planets and stars), I'm curious about what matmatic formulas are used for proper orbital mechanics, at the very liest, an attractor setup and a system to calculate orbits in this system, also planetary and even galactic drift is an eventual goal. My system would be totally fictional, but I'd also like to be able to generate a galaxy map for Celestia, or Maya (which I am familiar with the file formats at this time, and currently use for output visualization) The desire is to have a static or dynamic snapshot of planets with Celestia to see how the system's working.
I am also considering adding a backup system utility to allow me to test out the addition of new systems on future or current galactic position.
This MUD is a text based one that uses a varient of the Forth programming language to do it's work. Forth concepts of math and sintax are applied to a language set that is specific to the server. 1 1 + equils 2, for example.
- Ice
--------
"Ramble ramble ramble, if only I could code as fast as I ramble." - Ice

Topic author
Ice
Posts: 2
Joined: 18.12.2003
With us: 20 years 11 months

static on the airways.

Post #2by Ice » 23.03.2004, 08:41

I feel... cold.
okay, codebase aside, I am just curious about formulas.
I still need to add drift, but simple question, is there a formula for determining how much two bodies would attrack each other... o.O and how insane am I for wondering that.
"Ramble ramble ramble, if only I could code as fast as I ramble." - Ice

Kendrix
Posts: 159
Joined: 02.06.2002
With us: 22 years 5 months
Location: near Paris, France
Contact:

Post #3by Kendrix » 23.03.2004, 09:02

Yes ! The Universal Attraction Law of Newton :

F = G · m1 · m2 / d^2

where m1 and m2 are the mass of the 2 objects and d the distance between them.

G is the constant of gravitation which is 6.672e-11 (in Nm^2 / Kg^2)

Liquidscript
Posts: 8
Joined: 13.01.2003
With us: 21 years 10 months
Location: Arizona

Post #4by Liquidscript » 04.05.2004, 06:09

Something like this?
http://www.celestiaproject.net/forum/viewtopic.php?t=4990

I am working on a simple real time gravity simulation that approximates various orbiting bodies and the forces between them. I'll be happy to help.

Ok, the above equation works correctly if you want to use enormous mass values (which correspond to real world values) but in my simulation i set G == 1 unit to simplify the calculations. This way, the masses are easier to handle as round numbers like 500 or 100 or 10.

Another important equation if you want to make "an attractor setup and a system to calculate orbits in this system" is:

Fc = m v^2 / r, where m is mass, v is velocity, and r is the radius between the bodies.

This way, you can set up two bodies, such as a central star and a smaller planet that orbits it, and create a circular orbit by solving Fg = Fc, where Fg = G m1 m2 / d^2 and Fc = m1 v^2 / r. Solve for the velocity to get:

v = (+ or -) sqrt(G m2 / r) because d = r, so they cancel a bit.

This velocity is the velocity of the smaller mass for a circular orbit. It can be used to make circular orbits between 2 bodies. This can be used to create individual stable orbits in a solar system of your design.

tony873004
Posts: 132
Joined: 07.12.2003
With us: 20 years 11 months
Location: San Francisco http://www.gravitysimulator.com

Post #5by tony873004 » 04.05.2004, 18:25

Ice... Are you Seth from Orbiter? I can help you with the formulas.


Return to “Physics and Astronomy”