Jump to content
  • Advertisement


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


Looking for formula to calculate postion of celestial bodies

This topic is 5435 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''m working on game that consist of interplantary combat. Basically you launch attacks at other planets and I need a formula to calculate the postion of the planets. here the information so far. O - Planets Orbital speed R - Planets Rotational speed neither can equal 0, a positive value represent clockwise rotation and negative value represent counter clockwise rotation. For simplisity all planets have the same rotational axis and orbit in the same plane. C - is the speed of light also the games maxium velocity. Now each planet has a distance D which represents the distance between a planet and the current planet. There is also a delay value which represent the time it takes for light to travel from one planet to current which I think is equal to D/C. What I need is a formula to calculate displacement. Displacement - is the diffrence between a planets current postion and it perceived postion by the current planet. Also in the game there are weapons each weapon has a Velocity V which is greater then 0 and <= C. An example usage would be this: Earth is attacking planet Vega which is 2 light minutes away. Earth fires its laser cannon which has V=C. So in order to hit the planet the player has fire the cannon at the location where Vega will be in 2 minutes. They will then have to wait 4 minutes afer firing to see the effect. any help would be greatly appreciated. ----------------------------------------------------- Writer, Programer, Cook, I''m a Jack of all Trades Current Design project Chaos Factor Design Document

Share this post

Link to post
Share on other sites
To find the laws of planetary motion look up Kepler''s equations. I took astronautics last year and should remember them... but I don''t. To find the planet''s current position you just predict its position for a given time ''t.'' To predict the apparent position to a planet ''x'' light-minutes away you predict its position for a time ''t-x.''

Share this post

Link to post
Share on other sites
There's several ways to know the position of the planets. I can think of two very quickly:

If you do not care to be extremely accurate, and if you wish to add your own planets other than the ones that already exist, then you can compute the gravitational forces yourself, with accurate speed / masses of the planets / sun, and let the simulation run on its own, as I did with my own simple (DOS) gravity program:

Or, you can use equations to compute where the planets should be. Ken Silverman did this for his Globe program:
You will have to download the program and read the readme files to see where he got his information from. This is probably much more accurate than computing gravity yourself, but it means you cannot change the simulation, to add more planets / stars.

Jason Doucette | Matthew Doucette
Programming Windows , 5th Edition by Charles Petzold, Errata Addendum
projects / games | real-time graphics | artificial intelligence | world records | wallpapers / desktops / backgrounds
"Great minds discuss ideas, average minds discuss events, small minds discuss people." - Anna Eleanor Roosevelt, 1884-1962

[edited by - Jason Doucette on November 30, 2003 4:48:43 PM]

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!