🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Gravitational acceleration calculation

Started by
143 comments, last by taby 1 year, 10 months ago

Looking good. But, the galaxy components are moving too slow. Are you going to take dark matter into consideration?

I read the book Galactic Dynamics, but I lent it out.

Advertisement

P.S. The more I play with your simulations, the more impressed I become. Great job!

@taby No, I wasn’t considering dark matter. However, I was thinking of how to simulate spatial expansion. Especially for the random distribution scenario. I’d like to slow its collapse without weakening gravity.

None

Even without dark matter involved, the orbit speed is too slow to form circular orbit paths.

Do you remember my other post where I showed you how to calculate the orbit speed at perihelion?

@taby ya I was just too lazy to figure it out. I just wanted to get things going so I just got them as close as possible. also keep in mind the system drifts due to the rotational velocity of the planets in orbit. This prevents the orbits from looking perfect. Also if your browser is a different size than mine was when I calibrated the orbits they will be slightly off.

None

It sounds like you have a lot of work in the future. I will see about simulating a galaxy using my own code.

taby said:
Even without dark matter involved, the orbit speed is too slow to form circular orbit paths.

Not sure what you mean, but maybe the reason is the distance clamping, called ‘constrain’ in the older code. The value was often set very high, like 100 pixels, iirc.
You surely want to make this value as small as possible with the simulation still stable and not adding too much energy from planets which come close to each other.
(The more realistic solutions we had discussed probably won't work, because the radius of plants is too small it would remain stable.)

@taby, I’m not sure I follow what you think the problem is. Can you clarify it a bit? Do you think the solar system is wrong as well?

None

Well, I suppose that orbits are likely to be elliptical. I just thought that you'd want to simplify the galaxy model by making the orbiting stars move in circular orbits.

taby said:

Ok, here is the formula:

If you want a circular orbit, you place the object r metres away and set it flying at:
v = sqrt(G*M/r) metres per second

If you want an elliptical orbit, you set it flying at a lesser speed. To calculate the desired speed based on how eccentric the orbit is:
v = sqrt((G*M/r)*(1 - e)/(1 + e))

Alternatively, if you place the object at periapsis:
v = sqrt((G*M/r)*(1 + e)/(1 - e))

This…

This topic is closed to new replies.

Advertisement