Making Planets Move in HSpace -Mark Hassman (mark@moosh.net) 12/23/02 ----------------------------------------------------------------------------- Orbital dynamics is a complex topic and not really the focus for this document. However, assuming you have some interest, this document will attempt to guide you through putting planets (or stars, moons, etc) into motion within HSpace. First off, an assumption must be made that the center of the universe is at the coordinates 0,0,0. That is merely the centerpoint for the calculations. To put objects into motion, you will need to either make up or find data for the following attributes to be set on each object: INCLINATION: Angle between the ecliptic and the plane of the orbit. The ecliptic is the flat x,y plane between Earth and the Sun in our solar system where Z=0. In our solar system, this varies between 0 (Earth) and 17+ degrees (Pluto). LONGITUDE_ASCENDING: This is the position in the orbit where the elliptical path of the planet passes through plane of the ecliptic (Z=0) from below to above. This can be anywhere between 0 and 360 degrees. LONGITUDE_PERHELION: Position, in degrees, in the orbit where the planet is closest to the Sun. The value is again 0-360. MEAN_DISTANCE: The value of the semi-major axis of the orbit. For our solar system, these are typically Astronomical Units. For my test case, I converted to Megameters. So the value for Earth was approximately 149600 megameters. DAILY_MOTION: States how far, in degrees, the planet moves in mean solar day (24 earth hours). ECCENTRICITY: Eccentricity of the ellipse which describes the orbit. A value of 0 makes the orbit circular while values 0-1.0 describe an increasingly eccentric orbit. Values in our solar system range from nearly 0 to .25 for Pluto. Values > 1.0 are not handled in the softcode with this distribution. MEAN_ANOMALY: Position of the planet in its orbit on the date of the Elements. This value can be 0-360 degrees. It is useful when simulating known planets but can be set randomly for other solar systems. ORBITS (optional): DBREF of the planet (or other celestial) that the current planet orbits. So for the case of Deimos, ORBITS would be set to the DBREF of Mars. If a planet is orbiting another body, the values reference how the orbit occurs around the ORBITS body. Examples: MARS: &DAILY_MOTION Mars=0.5240613 &ECCENTRICITY Mars=0.0934231 &INCLINATION Mars=1.84992 &LONGITUDE_ASCENDING Mars=49.5665 &LONGITUDE_PERHELION Mars=336.0882 &MEAN_DISTANCE Mars=227936.0204 &MEAN_LONGITUDE Mars=262.42784 Luna (Earth's Moon) &DAILY_MOTION Luna=13.176358 &ECCENTRICITY Luna=0.0554 &INCLINATION Luna=5.16 &LONGITUDE_ASCENDING Luna=125.08 &LONGITUDE_PERHELION Luna=318.15 &MEAN_DISTANCE Luna=384.4 &MEAN_LONGITUDE Luna=1.00003 &ORBITS Luna=#7 After all the planets have values set, you can upload the softcode that "drives" the orbital motion. Beware, this can be CPU INTENSIVE due to the math involved and functional recursion. The code was written to be functional, not for efficiency. The object that runs the code must be set Wizard to change coordinates within HSpace. It also establishes two global functions sin_d and cos_d, which were used to simplify the softcode. After the softcode is in place, edit the DAT_PLANET_LIST to list the planets you want to put in orbit. After the list is done, @trigger the startup attribute of the Planetary Mover (PM). That will start an infinite loop that runs once every minute. The cycle then move each specified planet once per cycle. You can increase or decrease the @wait period as you see fit. Smaller wait times will eliminate the rapid jumps in position but will cause move cpu usage. Longer wait times will cause larger shifts in position when the cycle occurs.