CelestialBody
CelestialBody defines a class that represents a body with sufficient mass to be orbited.
The source file contains more functions than are documented on this page. These functions are either incomplete or are used in intermediate calculations in public documented functions. Note that functions that are not documented on this page are not intended to be used outside of the module or called by other scripts. However, if one is curious about these functions, there are comments in the source.
Fields
string name
The human-readable name of the planet.
number mass
kg
The mass of the celestial body.
number mu
km^3/s^2
mu
represents the Standard Gravitational Parameter , a quantity equal to the mass of the parent body multiplied by the Universal Gravitational Constant.
number radius
km
The radius of the celestial body.
number sphereOfInfluence
km
The radius of the gravitational sphere of influence of the Celestial Body. In Patched Conics, the sphere of influence is used to denote the distance from the parent body where the gravitational influence from that body is considered negligible and can be ignored.
If this CelestialBody has no parent, the sphere of influence is set to math.huge
.
Do not change this value manually. Instead, call SetParent(...)
CelestialBody parentBody
The CelestialBody this CelestialBody orbits. By default, is nil.
Do not change this value manually. Instead, call SetParent(...)
Orbit orbit
If this CelestialBody has a parent, this field defines the orbit this CelestialBody follows around its parent. If this CelestialBody does not have a parent, this field is nil.
Do not change this value manually. Instead, call SetParent(...)
CelestialBody[] childBodies
Contains all the CelestialBodies that orbit this CelestialBody.
Do not change this value manually. Instead, call SetParent(...)
Constructors
CelestialBody.new(...)
string name
: The human-readable name of the planet.
number mass
( kg): The mass of the celestial body.
number radius
( km): The radius of the celestial body.
Methods
CelestialBody:SetParent(...)
Sets this celestial body's parent as another celestial body.
CelestialBody otherCelestialBody
: The new parent body for this CelestialBody.
Orbit otherCelestialBody
: The orbit that defines motion about the parent body. Set to nil if this celestial's parent is nil and thus it should be the center of the universe.
Remarks: The CelestialBody graph must be a tree.