Gravity Engine 12.0
Unity Asset for Gravity
|
Solar system. This component is attached to a game object that is the Sun. It then manages the children of the Sun allowing editing and global scaling of planets, asteroids and comets. More...
Public Types | |
enum | Type { PLANET , ASTEROID , COMET } |
Public Member Functions | |
void | Init () |
void | UpdateEpochTime (float newTime) |
Sets the starting epoch time and adjusts the phase parameters of all bodies in the system accordingly. | |
void | UpdatePlanetScale (float scale) |
GameObject | AddObject (Type type, SolarBody sbody) |
void | InitOrbit (SolarBody sbody) |
void | SetTime (int year, int month, int day, float dayFrac) |
Run-time update of the solar system time. The new time must be a time later than the initial start time of the solar system. | |
float | GetStartEpochTime () |
Public Attributes | |
GameObject | planetPrefab |
Prefab to be used to create bodies in the SolarSystem via the editor or script calls. | |
GameObject | asteroidPrefab |
GameObject | cometPrefab |
bool | epochFoldout = false |
Static Public Attributes | |
const float | mass_sun = 1.989E6f |
Properties | |
float | planetScale [get, set] |
Planet scale in Unity units per 1000km. | |
float | epochTime [get, set] |
Solar system. This component is attached to a game object that is the Sun. It then manages the children of the Sun allowing editing and global scaling of planets, asteroids and comets.
The attributes of the planets can be altered (for "what if" experiments) by editing the children game objects that are created. They can also be reset to defaults by a call to RestoreDefaults()
void SolarSystem.SetTime | ( | int | year, |
int | month, | ||
int | day, | ||
float | dayFrac | ||
) |
Run-time update of the solar system time. The new time must be a time later than the initial start time of the solar system.
This API makes use of @GravityEngineSetPhysicalTime. This requires that ALL objects in the scene be "on-rails" i.e. have an OrbitXXX component and be in Kepler evolution mode.
year | |
month | |
day | |
dayFrac |
void SolarSystem.UpdateEpochTime | ( | float | newTime | ) |
Sets the starting epoch time and adjusts the phase parameters of all bodies in the system accordingly.
Phase is set by using the original orbit data reference. Any hand-tuning of phase by manual changes in the editor will be lost.
This method is typically called by the scene inspector. Not at run-time.
newTime | New time. |