Sign in to follow this  
SiS-Shadowman

Sun Orbit (from earth pov)

Recommended Posts

i've a problem. i'm writing a simulation wich shows a terrain ( on a planet ) and the sun, moon, stars etc.. but realistic ( so the "orbit" of everything depends on the latitude of the terrain ) but i don't know how i can calc the coordinates for the sun / moon. i've already calculated the earth rotationmatrix, wich will be useful for rotation the starbox, but how can i create an orbit for the inner solar objects? i've no idea how to do that.

Share this post


Link to post
Share on other sites
Are the sun/earth/moon supposed to move under the influence of gravity?
If yes, you are actually trying to solve the "n body problem" which is far too complicated for three objects. (in fact it may not even have an analytic solution)
Expressing the trajectory of a celestial body as a function of some parameter, is not that easy as it seems.
If you want the actual trajectories, I suppose the only way is to come up with them in real time. Thus, you should set up a dynamic simulation and let three point-masses move under the influence of their own weight. Start the simulation, and let it drive your animation. However there are still issues to consider; e.g. how will you come up with the rotations around their own axes? You'll have to cheat somewhere...

If you would settle for a good approximation, you can always use the parametric equations for a circle or ellipse and simulate the orbits of the earth and moon around the sun. However, there are still issues with that too. E.g. you'll have to find a parametrization that represents actual time in your equations, and to derive such a parameter you'll have to know the actual speed of the body at any point on its orbit...

It's not a trivial problem as it looks first glance...
If you want this to be as realistic as possible, go for the realtime dynamics simulation.

Share this post


Link to post
Share on other sites
Frame-Based Hierarchy Systems are really good for this sort of thing, or anything requiring additive transformations. Each object would have a separate frame of reference, and therefore a separate matrix. I can't go into the details at the moment, but it's something you might want to look into.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this