Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

doctorsixstring

Orbits, Gravity, and You

This topic is 5363 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am developing a solar system simulator for my current game project, and I want to accurately model planetary orbits and gravity (within reason). My main question right now is: If the gravitational force of one space body (like the sun) pulls on another space body (a planet), what stops that planet from simply flying towards the sun and crashing into it? What force propels the planet in a circular/elliptical orbit around the sun? I have thought about simply giving each planet an "acceleration" that is constantly applied at a perpendicular angle to the direction to the sun. If I use the proper values, this could work. However, if there is an easier/more realistic way, I would love to hear about it. Also, what role does a planet''s rotation play on its orbital behavior? Thanks in advance, Mike

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
If the planet just sort of "appeared" in space, and was not moving at all in relation to the sun, then it would in fact just be pulled right into the sun (eventually). It''s the fact that the planet is in motion and *really* far away from the sun which cause it to slowly spiral in, instead of just going directly there. Make no mistake, though, all the planets will eventually get eaten by the sun (or white dwarf or neutron star or whatever forms later...).

Share this post


Link to post
Share on other sites
The force of gravity pretty much points perpendicular to the direction of current motion, and so diverts the planet off its course, which would otherwise fly away from the sun.

Share this post


Link to post
Share on other sites
The planets are NOT spiraling in. They are in fact if anything, spiraling away since the sun is constantly losing mass, and hence gravitational force. But the change is so minor that the Earth and other inner planets will be devoured by the sun as it expands in its old age, long before the Earth has a chance to escape. The Moon is also slowly escaping from the Earth, but due to an entirely different reason. The Moon''s tidal forces on Earth are effectively stealing some of Earth''s orbital momentum. And so, as the Moon slowly speeds up, its orbital radius increaeses. About an inch a year if memory serves me right. In several millenia, the Moon will escape Earth, and simply become another planet in orbit about the sun.

Share this post


Link to post
Share on other sites
Warning! If you use a discrete integrator, which you will, you may get poor results; either flying away or into the sun. The quality of your (numerical) integrator is very important. I suggest a fourt-order Runge-Kutta.

If you use Newton (just add plain ol'' v*t to pos every step) you''ll diverge very quickly.

Share this post


Link to post
Share on other sites
If you're want a quick and simple simulation, just parameterize the orbits as circles.

x(t) = A*sin(time*speed + timeOffset) + xOffset
y(t) = A*cos(time*speed + timeOffset) + yOffset

Different planets would have different speed, timeOffset and x and y offsets. The speed varies as:

v^2/r = a = G*M/r^2 (circular motion)

or speed v is inversely proportional to distance from the central attracting body.

Parameterizing elliptical orbits that vary their speed continuously is somewhat more difficult.

The reason the planets don't fall into the sun can be stated in a variety of ways...

Consider that they have too much energy... gravity is a conservative force so no energy is lost when an object is acted upon by gravity. Instead, energy is equally exchanged between potential and kinetic energy of the object acted upon by the force.

Alternatively, they force always acts in the direction facing towards the attracting body... it is a "central force." When integerated, the force of gravity, which varies inversely with the square of distance to the attracting body gives rise to elliptical, hyperbolic or parabolic "orbits" depending on the amounts of energy and angular momentum possed by the object. It just works out that as the object is pulled nearer the attractor, it swings around instead of falling into it if it has any initial velocity that is not directed parallel to the direction between the object and attractor. If you write your orbit simulator, you'll observe this. It can also be shown analytically for two mutually attracting bodies.

If you give each planet a constant acceleration that's directed towards the sun, you well get only circular orbits, in which case you may as well just use parameterized orbts...

Planets can exchange angular momentum between their rotation about their axis and their rotation about another body and that body's rotation about its own axis. For example, due to tidal friction effects with the moon, the earth's rotation is currently slowing down, and the moon is moving further away from the earth. Over billions of years, the earth's rotation will eventually slow until the moon is fixed in the sky (if the sun doesn't expand into a red giant and evelop the earth and moon first). The moon is already slowed in this manner... the same side of it is always facing the earth (it's day is one month long). As the earth slow s its rotation, so will the moon slow its rotation about the earth. Pluto and Charon are already mutually tidally locked. Mercury is in a similar state, with it's day being two thirds of a year (or maybe it's the other way around...?)

Tidal friction is a much smaller effect than the large scale motions of planets and moons and such, however, and can generally be ignored for most astronomical simulation purposes.

Edit: Fourth order Runge-Kutta would work, but other methods can be effective, such as leapfrog, which is apparently better due to its theoretical reversibility and corresponding conservation of analytically conserved quantities.

[edited by - Geoff the Medio on November 7, 2003 10:36:49 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by cowsarenotevil
Wouldn''t "air" resistance eventually cause planets to fall into the sun, extremely slowly?
I think the repulsive effect of solar wind would outweigh that.

Share this post


Link to post
Share on other sites
Yeah, if I remembered anything from astronautics I''d help you out, but the best I can say is look up the Keplerian equations and their derivation.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!