KSP API
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
Public Member Functions | Public Attributes | Properties | List of all members
CelestialBody Class Reference

The Sun, the planets, and the moons are all CelestialBodies. More...

Public Member Functions

 CelestialBody ()
 
void CBUpdate ()
 
void debugTimeWarpLimits ()
 
void DisplaySurfaceResource (int resourceID)
 
double GetAltitude (Vector3d worldPos)
 Gets the height of a given position above this body's sea level, in meters. More...
 
Bounds getBounds ()
 
Vector3d GetFrameVel ()
 The velocity of the CelestialBody, {AliceWorld, Sun}. (See Orbit.cs for the reference frame definitions). More...
 
Vector3d GetFrameVelAtUT (double UT)
 
Vector3 GetFwdVector ()
 
double GetLatitude (Vector3d worldPos)
 Gets the latitude of a given position, in degrees. More...
 
double GetLongitude (Vector3d worldPos)
 Gets the longitude of a given position, in degrees. Note that you CANNOT count on this value being in any particular range. This function may for example return 420, meaning 60 degrees east. You would be well advised to coerce it into a standard range like -180 to 180 before using it. More...
 
string GetName ()
 
Vector3 GetObtVelocity ()
 
Orbit GetOrbit ()
 
OrbitDriver GetOrbitDriver ()
 
Vector3d getPositionAtUT (double UT)
 
Vector3d GetRelSurfaceNVector (double lat, double lon)
 
Vector3d GetRelSurfacePosition (Vector3d worldPosition)
 
Vector3d GetRelSurfacePosition (double lat, double lon, double alt)
 Returns a vector pointing from the center of the body to the given latitude, longitude, and altitude. More...
 
Vector3d getRFrmVel (Vector3d worldPos)
 Returns the velocity at a given position of the frame of reference that rotates with the planet. This velocity is the difference between the "orbit" and "surface" velocities. More...
 
Vector3 GetSrfVelocity ()
 
Vector3d GetSurfaceNVector (double lat, double lon)
 Returns a unit vector perpendicular to the surface of the body at the given latitude and longitude (pretending for the moment that the body is a perfect sphere). More...
 
VesselTargetModes GetTargetingMode ()
 
Transform GetTransform ()
 
Vector3d getTruePositionAtUT (double UT)
 
Vessel GetVessel ()
 
Vector3d GetWorldSurfacePosition (double lat, double lon, double alt)
 Returns the position, in world coordinates, of a given latitude, longitude, and altitude More...
 
bool HasChild (CelestialBody body)
 
bool HasParent (CelestialBody body)
 
void HideSurfaceResource ()
 
void resetTimeWarpLimits ()
 
double RevealAltitude ()
 Returns the body's altitude above the reference sphere of its primary More...
 
float RevealMass ()
 Returns the body's mass, in kg More...
 
string RevealName ()
 Returns the body's tracking station name More...
 
string RevealSituationString ()
 Describes the state of the body More...
 
double RevealSpeed ()
 Returns the body's speed More...
 
string RevealType ()
 Returns the type of the body More...
 

Public Attributes

float altitudeMultiplier
 
float altitudeOffset
 
double angularV
 The magnitude of the angular velocity of the body's rotation, in radians per second. More...
 
Vector3d angularVelocity
 The body's angular velocity vector, in rotations per second. This points along the axis of rotation and its magnitude is the rotation rate in radians per second. More...
 
float atmoshpereTemperatureMultiplier
 
bool atmosphere
 Whether this body has an atmosphere More...
 
bool atmosphereContainsOxygen
 Presumably, whether jet engines will work in this body's atmosphere More...
 
float atmosphereMultiplier
 Seems to be the pressure of the body's atmosphere at sea level, in units of Kerbin atmospheres at sea level. Appears to only have an effect when useLegacyAtmosphere is toggled on More...
 
double atmosphereScaleHeight
 The atmosphere's scale height, in KILOMETERS (not meters). The atmospheric pressure at a given altitude above sea level is proportional to Math.Exp(-altitude / atmosphereScaleHeight). More...
 
Color atmosphericAmbientColor
 
CBAttributeMap BiomeMap
 
string bodyDescription
 
string bodyName
 The name of the body, as a string. More...
 
Transform bodyTransform
 
CelestialBodyType bodyType
 
double directRotAngle
 
double GeeASL
 The gravitational acceleration of the body at sea level, in units of gees (1 gee = 9.81 m/s^2) More...
 
double gMagnitudeAtCenter
 The gravitational acceleration (in m/s^2) at a radius r (in m) from the body's center is gMagnitudeAtCenter / r^2 More...
 
double gravParameter
 The gravitational parameter GM is the universal gravitational constant G times the mass M of the body. In KSP the gravitational constant G is exactly 6.673 m^3 / (kg s^2), and the body mass is measured in kilograms. More...
 
double hillSphere
 Unused? More...
 
double initialRotation
 
bool inverseRotation
 
float inverseRotThresholdAltitude
 
double Mass
 The mass of the body in kilograms. Computed More...
 
float maxAtmosphereAltitude
 The height of the upper edge of the body's atmosphere, in meters above sea level. Except, not really. The atmosphere really cuts off at an altitude (in meters) of More...
 
bool ocean
 Whether this planet has an ocean at "sea level" More...
 
OrbitDriver orbitDriver
 this is what gives the celestial body its orbit and makes it go along the orbit as well More...
 
List< CelestialBodyorbitingBodies
 A list of this body's moons (or, in the case of the Sun, a list of the planets). More...
 
PQS pqsController
 The pqsController computes the terrain of the planet. Note that for the Sun, pqsController = null. More...
 
AnimationCurve pressureCurve
 
float pressureMultiplier
 
double Radius
 The radius of the planet in meters. Note that this is only the radius of "sea level"; the actual terrain may be higher. More...
 
bool rotates
 
QuaternionD rotation
 
double rotationAngle
 
double rotationPeriod
 The time, in seconds, for the body to complete one rotation around its axis More...
 
CelestialBodyScienceParams scienceValues
 
double sphereOfInfluence
 The radius of this body's sphere of influence (measured from the center of the body), in meters. More...
 
double staticPressureASL
 
AnimationCurve temperatureCurve
 
bool tidallyLocked
 Presumably, whether this body is tidally locked to the body around with it orbits. More...
 
float[] timeWarpAltitudeLimits
 Presumably, this gives the minimum altitude you must have in order to be allowed to use each warp rate when in this body's sphere of influence. More...
 
bool use_The_InName
 
bool useLegacyAtmosphere
 It appears that this setting toggles between old and new atmosphere system More...
 
Vector3d zUpAngularVelocity
 

Properties

DiscoveryInfo DiscoveryInfo [get]
 Describes to what extent this body has been explored More...
 
int flightGlobalsIndex [get, set]
 
string name [get]
 
Orbit orbit [get]
 Describes the orbit of this body around its primary. More...
 
Vector3d position [get, set]
 The position of the center of the body, in world coordinates. More...
 
CelestialBody referenceBody [get]
 Presumably, the body this body orbits around More...
 
Texture2D ResourceMap [get]
 
PResource Resources [get]
 
string theName [get]
 

Detailed Description

The Sun, the planets, and the moons are all CelestialBodies.

Constructor & Destructor Documentation

CelestialBody.CelestialBody ( )

Member Function Documentation

void CelestialBody.CBUpdate ( )
void CelestialBody.debugTimeWarpLimits ( )
void CelestialBody.DisplaySurfaceResource ( int  resourceID)
double CelestialBody.GetAltitude ( Vector3d  worldPos)

Gets the height of a given position above this body's sea level, in meters.

Parameters
worldPosA position in world coordinates
Returns
Altitude in meters
Bounds CelestialBody.getBounds ( )
Vector3d CelestialBody.GetFrameVel ( )

The velocity of the CelestialBody, {AliceWorld, Sun}. (See Orbit.cs for the reference frame definitions).

Vector3d CelestialBody.GetFrameVelAtUT ( double  UT)
Vector3 CelestialBody.GetFwdVector ( )
double CelestialBody.GetLatitude ( Vector3d  worldPos)

Gets the latitude of a given position, in degrees.

Parameters
worldPosA position in world coordinates
Returns
Latitude in degrees
double CelestialBody.GetLongitude ( Vector3d  worldPos)

Gets the longitude of a given position, in degrees. Note that you CANNOT count on this value being in any particular range. This function may for example return 420, meaning 60 degrees east. You would be well advised to coerce it into a standard range like -180 to 180 before using it.

Parameters
worldPosA position in world coordinates
Returns
Longitude in degrees
string CelestialBody.GetName ( )
Vector3 CelestialBody.GetObtVelocity ( )
Orbit CelestialBody.GetOrbit ( )
OrbitDriver CelestialBody.GetOrbitDriver ( )
Vector3d CelestialBody.getPositionAtUT ( double  UT)
Vector3d CelestialBody.GetRelSurfaceNVector ( double  lat,
double  lon 
)
Vector3d CelestialBody.GetRelSurfacePosition ( Vector3d  worldPosition)
Vector3d CelestialBody.GetRelSurfacePosition ( double  lat,
double  lon,
double  alt 
)

Returns a vector pointing from the center of the body to the given latitude, longitude, and altitude.

Parameters
latLatitude in degrees
lonLongitude in degrees
altAltitude above sea level in meters
Returns
A position vector relative to the center of the body
Vector3d CelestialBody.getRFrmVel ( Vector3d  worldPos)

Returns the velocity at a given position of the frame of reference that rotates with the planet. This velocity is the difference between the "orbit" and "surface" velocities.

Parameters
worldPosA position in world coordinates
Returns
Velocity of the rotating reference frame
Vector3 CelestialBody.GetSrfVelocity ( )
Vector3d CelestialBody.GetSurfaceNVector ( double  lat,
double  lon 
)

Returns a unit vector perpendicular to the surface of the body at the given latitude and longitude (pretending for the moment that the body is a perfect sphere).

Parameters
latLatitude in degrees
lonLongitude in degrees
Returns
A unit normal vector to the surface
VesselTargetModes CelestialBody.GetTargetingMode ( )
Transform CelestialBody.GetTransform ( )
Vector3d CelestialBody.getTruePositionAtUT ( double  UT)
Vessel CelestialBody.GetVessel ( )
Vector3d CelestialBody.GetWorldSurfacePosition ( double  lat,
double  lon,
double  alt 
)

Returns the position, in world coordinates, of a given latitude, longitude, and altitude

Parameters
latLatitude in degrees
lonLongitude in degrees
altAltitude above sea level in meters
Returns
Position in world coordinates
bool CelestialBody.HasChild ( CelestialBody  body)
bool CelestialBody.HasParent ( CelestialBody  body)
void CelestialBody.HideSurfaceResource ( )
void CelestialBody.resetTimeWarpLimits ( )
double CelestialBody.RevealAltitude ( )

Returns the body's altitude above the reference sphere of its primary

Implements IDiscoverable

float CelestialBody.RevealMass ( )

Returns the body's mass, in kg

Implements IDiscoverable

string CelestialBody.RevealName ( )

Returns the body's tracking station name

Implements IDiscoverable

string CelestialBody.RevealSituationString ( )

Describes the state of the body

Returns
A string containing the sphere of influence and trajectory of the object

"Orbiting the Sun"

Implements IDiscoverable

double CelestialBody.RevealSpeed ( )

Returns the body's speed

Implements IDiscoverable

string CelestialBody.RevealType ( )

Returns the type of the body

Returns
One of "Sun", "Planet", or "Moon"

Implements IDiscoverable

Member Data Documentation

float CelestialBody.altitudeMultiplier
float CelestialBody.altitudeOffset
double CelestialBody.angularV

The magnitude of the angular velocity of the body's rotation, in radians per second.

Vector3d CelestialBody.angularVelocity

The body's angular velocity vector, in rotations per second. This points along the axis of rotation and its magnitude is the rotation rate in radians per second.

float CelestialBody.atmoshpereTemperatureMultiplier
bool CelestialBody.atmosphere

Whether this body has an atmosphere

bool CelestialBody.atmosphereContainsOxygen

Presumably, whether jet engines will work in this body's atmosphere

float CelestialBody.atmosphereMultiplier

Seems to be the pressure of the body's atmosphere at sea level, in units of Kerbin atmospheres at sea level. Appears to only have an effect when useLegacyAtmosphere is toggled on

double CelestialBody.atmosphereScaleHeight

The atmosphere's scale height, in KILOMETERS (not meters). The atmospheric pressure at a given altitude above sea level is proportional to Math.Exp(-altitude / atmosphereScaleHeight).

Color CelestialBody.atmosphericAmbientColor
CBAttributeMap CelestialBody.BiomeMap
string CelestialBody.bodyDescription
string CelestialBody.bodyName

The name of the body, as a string.

Transform CelestialBody.bodyTransform
CelestialBodyType CelestialBody.bodyType
double CelestialBody.directRotAngle
double CelestialBody.GeeASL

The gravitational acceleration of the body at sea level, in units of gees (1 gee = 9.81 m/s^2)

double CelestialBody.gMagnitudeAtCenter

The gravitational acceleration (in m/s^2) at a radius r (in m) from the body's center is gMagnitudeAtCenter / r^2

double CelestialBody.gravParameter

The gravitational parameter GM is the universal gravitational constant G times the mass M of the body. In KSP the gravitational constant G is exactly 6.673 m^3 / (kg s^2), and the body mass is measured in kilograms.

double CelestialBody.hillSphere

Unused?

double CelestialBody.initialRotation
bool CelestialBody.inverseRotation
float CelestialBody.inverseRotThresholdAltitude
double CelestialBody.Mass

The mass of the body in kilograms. Computed

float CelestialBody.maxAtmosphereAltitude

The height of the upper edge of the body's atmosphere, in meters above sea level. Except, not really. The atmosphere really cuts off at an altitude (in meters) of

body.atmosphereScaleHeight * 1000 * Math.Log(1e6)

bool CelestialBody.ocean

Whether this planet has an ocean at "sea level"

OrbitDriver CelestialBody.orbitDriver

this is what gives the celestial body its orbit and makes it go along the orbit as well

List<CelestialBody> CelestialBody.orbitingBodies

A list of this body's moons (or, in the case of the Sun, a list of the planets).

PQS CelestialBody.pqsController

The pqsController computes the terrain of the planet. Note that for the Sun, pqsController = null.

AnimationCurve CelestialBody.pressureCurve
float CelestialBody.pressureMultiplier
double CelestialBody.Radius

The radius of the planet in meters. Note that this is only the radius of "sea level"; the actual terrain may be higher.

bool CelestialBody.rotates
QuaternionD CelestialBody.rotation
double CelestialBody.rotationAngle
double CelestialBody.rotationPeriod

The time, in seconds, for the body to complete one rotation around its axis

CelestialBodyScienceParams CelestialBody.scienceValues
double CelestialBody.sphereOfInfluence

The radius of this body's sphere of influence (measured from the center of the body), in meters.

double CelestialBody.staticPressureASL
AnimationCurve CelestialBody.temperatureCurve
bool CelestialBody.tidallyLocked

Presumably, whether this body is tidally locked to the body around with it orbits.

float [] CelestialBody.timeWarpAltitudeLimits

Presumably, this gives the minimum altitude you must have in order to be allowed to use each warp rate when in this body's sphere of influence.

bool CelestialBody.use_The_InName
bool CelestialBody.useLegacyAtmosphere

It appears that this setting toggles between old and new atmosphere system

Vector3d CelestialBody.zUpAngularVelocity

Property Documentation

DiscoveryInfo CelestialBody.DiscoveryInfo
get

Describes to what extent this body has been explored

int CelestialBody.flightGlobalsIndex
getset
string CelestialBody.name
get
Orbit CelestialBody.orbit
get

Describes the orbit of this body around its primary.

Vector3d CelestialBody.position
getset

The position of the center of the body, in world coordinates.

CelestialBody CelestialBody.referenceBody
get

Presumably, the body this body orbits around

Texture2D CelestialBody.ResourceMap
get
PResource CelestialBody.Resources
get
string CelestialBody.theName
get

The documentation for this class was generated from the following file: