Difference between revisions of "API:CelestialBody"

From Kerbal Space Program Wiki
Jump to: navigation, search
 
(13 intermediate revisions by 4 users not shown)
Line 5: Line 5:
 
|implements=ITargetable, IDiscoverable
 
|implements=ITargetable, IDiscoverable
 
}}
 
}}
 +
 
{{PropertiesStart}}
 
{{PropertiesStart}}
 
{{Property
 
{{Property
Line 11: Line 12:
 
|hasget=1
 
|hasget=1
 
}}
 
}}
 +
 
{{Property
 
{{Property
 
|type=int
 
|type=int
Line 16: Line 18:
 
|hasget=1
 
|hasget=1
 
|hasset=1
 
|hasset=1
 +
|desc=The place the body has in the list <code>FlightGlobals.Bodies</code>
 
}}
 
}}
 +
 
{{Property
 
{{Property
 
|type=string
 
|type=string
Line 23: Line 27:
 
|desc=The name of the body, as it appears in e.g. the map view. Same as <code>bodyName</code> field.
 
|desc=The name of the body, as it appears in e.g. the map view. Same as <code>bodyName</code> field.
 
}}
 
}}
 +
 
{{Property
 
{{Property
 
|type=Orbit
 
|type=Orbit
Line 29: Line 34:
 
|desc=Contains all information about the body's orbit around whatever other body it is orbiting.
 
|desc=Contains all information about the body's orbit around whatever other body it is orbiting.
 
}}
 
}}
 +
 
{{Property
 
{{Property
 
|type=Vector3d
 
|type=Vector3d
Line 36: Line 42:
 
|desc=The position of the center of the body in world space.
 
|desc=The position of the center of the body in world space.
 
}}
 
}}
 +
 
{{Property
 
{{Property
 
|type=CelestialBody
 
|type=CelestialBody
 
|name=referenceBody
 
|name=referenceBody
 
|hasget=1
 
|hasget=1
|desc=(not confirmed) The celestial body that this one orbits.
+
|desc=The celestial body that this one orbits.
 
}}
 
}}
 +
 
{{Property
 
{{Property
 
|type=Texture2D
 
|type=Texture2D
Line 47: Line 55:
 
|hasget=1
 
|hasget=1
 
}}
 
}}
 +
 
{{Property
 
{{Property
 
|type=PResource
 
|type=PResource
Line 52: Line 61:
 
|hasget=1
 
|hasget=1
 
}}
 
}}
 +
 
{{Property
 
{{Property
 
|type=string
 
|type=string
 
|name=theName
 
|name=theName
 
|hasget=1
 
|hasget=1
|desc=(not confirmed) Same as <code>name</code> except prefixed with "the " (if appropriate)
+
|desc=Body's name preceded by appropriate article ("the" or nothing)
 
}}
 
}}
 +
 
{{PropertiesEnd}}
 
{{PropertiesEnd}}
 +
 +
 +
 
{{FieldsStart}}
 
{{FieldsStart}}
 +
 
{{Field|type=float|name=altitudeMultiplier}}
 
{{Field|type=float|name=altitudeMultiplier}}
 
{{Field|type=float|name=altitudeOffset}}
 
{{Field|type=float|name=altitudeOffset}}
  
{{Field|type=double|name=angularV|desc=The magnitude of <code>angularVelocity</code>}}
+
{{Field
{{Field|type=Vector3d|name=angularVelocity}}
+
|type=double
{{Field|type=float|name=atmosphereTemperatureMultiplier}}
+
|name=angularV
{{Field|type=bool|name=atmosphere}}
+
|desc=The magnitude of <code>angularVelocity</code>
 +
}}
  
{{Field|type=bool|name=atmosphereContainsOxygen}}
+
{{Field
 +
|type=Vector3d
 +
|name=angularVelocity
 +
|desc=Similar to <code>zUpAngularVelocity</code>: [[w:Rotation_formalisms_in_three_dimensions#Euler_axis_and_angle_.28rotation_vector.29|Rotation vector]], with y and z axes swapped
 +
}}
  
{{Field|type=float|name=atmosphereMultiplier}}
 
  
{{Field|type=double|name=atmosphereScaleHeight}}
+
{{Field
 +
|type=bool
 +
|name=atmosphere
 +
|desc=Whether the body has an atmosphere
 +
}}
 +
 
 +
{{Field
 +
|type=bool
 +
|name=atmosphereContainsOxygen
 +
|desc=Whether oxygen is available (for jet engines)
 +
}}
 +
 
  
 
{{Field|type=Color|name=atmosphericAmbientColor}}
 
{{Field|type=Color|name=atmosphericAmbientColor}}
 +
 +
{{Field|type=Float|name=atmosphereDepth}}
 +
{{Field|type=bool|name=atmosphereUsePressureCurve}}
 +
{{Field|type=bool|name=atmospherePressureCurveIsNormalized}}
 +
 +
{{Field
 +
|type=float
 +
|name=.atmospherePressureSeaLevel
 +
|desc=Pressure at sea level (atm)
 +
}}
 +
 +
{{Field|type=Float|name=atmosphereTemperatureLapseRate}}
 +
{{Field|type=Float|name=atmosphereGasMassLapseRate}}
  
 
{{Field|type=CBAttributeMap|name=BiomeMap}}
 
{{Field|type=CBAttributeMap|name=BiomeMap}}
  
{{Field|type=string|name=bodyName|desc=Same as the <code>name</code> property}}
+
{{Field
 +
|type=string
 +
|name=bodyName
 +
|desc=Same as the <code>name</code> property
 +
}}
  
 
{{Field|type=Transform|name=bodyTransition}}
 
{{Field|type=Transform|name=bodyTransition}}
Line 86: Line 133:
 
{{Field|type=double|name=directRotAngle}}
 
{{Field|type=double|name=directRotAngle}}
  
{{Field|type=double|name=GeeASL|desc=Force of gravity at sea level?}}
+
{{Field
 +
|type=double
 +
|name=GeeASL
 +
|desc=Gravity At Sea Level; in multiple of g (aka “gees”) the gravity at sea level on Kerbin, defined as 9.81 m/s²
 +
}}
  
{{Field|type=double|name=gMagnitudeAtCenter|desc=Equal to <code>GeeASL</code> * 9.81 * <code>Radius</code>^2}}
+
{{Field
 +
|type=double
 +
|name=gMagnitudeAtCenter
 +
|desc=Same as <code>gravParameter</code> (below)
 +
}}
  
 
{{Field
 
{{Field
 
|type=double
 
|type=double
 
|name=gravParameter
 
|name=gravParameter
|desc=Gravitational parameter (G × Mass)
+
|desc=[[w:Standard gravitational parameter|Gravitational parameter]] (G × Mass), computed as <math>\mbox{GeeASL} \times g \times \mbox{Radius}^2</math> where g = 9.81.
 +
}}
  
 +
{{Field
 +
|type=double
 +
|name=hillSphere
 +
|desc=Radius of body's [[w:Hill sphere|Hill sphere]] computed as <math>R_H = a (1-e) \left(\frac{M_{\mathrm{planet}}}{M_\star}\right)^{1/3}</math>.
 
}}
 
}}
{{Field|type=double|name=hillSphere}}
 
  
 
{{Field|type=double|name=initialRotation}}
 
{{Field|type=double|name=initialRotation}}
Line 107: Line 166:
 
|type=double
 
|type=double
 
|name=Mass
 
|name=Mass
|desc=the mass of the body (kg). Computed as M = µ/G where µ is the gravitational parameter (exactly 6.674e-11 N⋅m²⋅kg⁻² in KSP)
+
|desc=body's mass (kg), computed as M = µ/G where µ is the body's gravitational parameter (<code>gravParameter</code>) and G=6.674e-11 N⋅m²⋅kg⁻² (instead of G=6.67384e-11 N⋅m²⋅kg⁻²)
 
}}
 
}}
 +
 
{{Field
 
{{Field
 
|type=double
 
|type=double
 
|name=maxAtmosphereAltitude
 
|name=maxAtmosphereAltitude
|desc=The height above sea level at which the atmosphere ends, in meters.
+
|desc=Used when useLegacyAtmosphere is False; atmosphere top altitude (m)
 
}}
 
}}
 +
 
{{Field|type=bool|name=ocean}}
 
{{Field|type=bool|name=ocean}}
  
Line 123: Line 184:
 
|name=orbitingBodies
 
|name=orbitingBodies
 
|desc=A list of all the bodies that orbit this one (e.g., the moons of a planet)
 
|desc=A list of all the bodies that orbit this one (e.g., the moons of a planet)
 +
}}
  
}}
 
 
{{Field
 
{{Field
 
|type=PQS
 
|type=PQS
 
|name=pqsController
 
|name=pqsController
|desc=An object that can give you information about the planet's terrain height as a function of position. See the documentation on the PQS class to see how to use it.
+
|desc=An object that can give you information about the planet's terrain height as a function of position. See the documentation on the <code>PQS</code> class to see how to use it.
 +
}}
 +
 
 +
{{Field
 +
|type=AnimationCurve
 +
|name=pressureCurve
 +
|desc=Used when <code>useLegacyAtmosphere</code> is False; <code>AnimationCurve</code> mapping some altitudes (m) to pressure ratios (atm); actual pressure is obtained by multiplying by pressureMultiplier
 
}}
 
}}
{{Field|type=AnimationCurve|name=pressureCurve|desc = Atmospheric pressure by altitude stored as an AnimationCurve. Altitude is in meters stored as Keys. Pressure is in atmospheres stored as Values. Multiplied by pressureMultiplier to determine final pressure for a given altitude. useLegacyAtmosphere must be set to False!}}
 
  
{{Field|type=float|name=pressureMultiplier|desc = Multiplies atmospheric pressure as determined by pressureCurve when useLegacyAtmosphere is False.}}
+
{{Field
 +
|type=float
 +
|name=pressureMultiplier
 +
|desc=Used when <code>useLegacyAtmosphere</code> is False; linear factor in pressure (non-zero only on Kerbol, where it is set to 1000000)
 +
}}
  
 
{{Field
 
{{Field
Line 144: Line 214:
 
{{Field|type=QuaternionD|name=rotation}}
 
{{Field|type=QuaternionD|name=rotation}}
  
{{Field|type=double|name=rotationAngle|desc=The current angle of the body's rotation}}
+
{{Field
 +
|type=double
 +
|name=rotationAngle
 +
|desc=The current angle of the body's rotation
 +
}}
  
 
{{Field
 
{{Field
Line 150: Line 224:
 
|name=rotationPeriod
 
|name=rotationPeriod
 
|desc=How long it takes the planet to revolve once about its axis, in seconds.
 
|desc=How long it takes the planet to revolve once about its axis, in seconds.
 +
}}
  
}}
 
 
{{Field|type=CelestialBodyScienceParams|name=scienceValues}}
 
{{Field|type=CelestialBodyScienceParams|name=scienceValues}}
  
Line 157: Line 231:
 
|type=double
 
|type=double
 
|name=sphereOfInfluence
 
|name=sphereOfInfluence
|desc=The radius of the body's sphere of influence, in meters, measured from the center of the planet (not sea level).
+
|desc=Radius of the body's [[w:Sphere of influence (astrodynamics)|sphere of influence]] (m); measured from the center of the planet, not from sea level.
 +
}}
  
 +
{{Field
 +
|type=double
 +
|name=staticPressureASL
 +
|desc=?; 21.46 on Kerbol, 1 everywhere else
 
}}
 
}}
{{Field|type=double|name=staticPressureASL}}
 
  
 
{{Field|type=AnimationCurve|name=temperatureCurve}}
 
{{Field|type=AnimationCurve|name=temperatureCurve}}
Line 166: Line 244:
 
{{Field|type=PlanetQuadTreeController|name=terrainController}}
 
{{Field|type=PlanetQuadTreeController|name=terrainController}}
  
{{Field|type=bool|name=tidallyLocked}}
+
{{Field
 +
|type=bool
 +
|name=tidallyLocked
 +
|desc=Whether the body is tidally locked to its primary (its rotational period is its orbital period)
 +
}}
  
 
{{Field|type=array of float|name=timeWarpAltitudeLimits}}
 
{{Field|type=array of float|name=timeWarpAltitudeLimits}}
  
{{Field|type=bool|name=useLegacyAtmosphere|desc = If True then atmospheric pressure is determined by atmosphere at sea level decreasing 1/2.718 every scaleHeight kilometers. Lowest possible pressure value is 1e-6 when useLegacyAtmosphere = True.}}
+
{{Field
 +
|type=bool
 +
|name=useLegacyAtmosphere
 +
|desc=If True, then atmospheric pressure is based on [[w:Scale height|scale height]] and atmosphere height threshold is a millionth of sea level pressure. Currently set to True for all bodies with an atmosphere.
 +
}}
  
{{Field|type=bool|name=use_The_InName|When true, the <code>theName</code> property will include "the " in the body's name}}
+
{{Field
 +
|type=bool
 +
|name=use_The_InName
 +
|desc=Whether the body's name should be preceded by "the" in a sentence (e.g. "The Sun is pretty hot")
 +
}}
 +
 
 +
{{Field
 +
|type=Vector3d
 +
|name=zUpAngularVelocity
 +
|desc=[[w:Rotation_formalisms_in_three_dimensions#Euler_axis_and_angle_.28rotation_vector.29|Rotation vector]]
 +
}}
  
{{Field|type=Vector3d|name=zUpAngularVelocity}}
 
 
{{FieldsEnd}}
 
{{FieldsEnd}}
 
{{MethodsStart}}
 
{{MethodsStart}}
Line 184: Line 279:
 
|desc=The altitude above sea level of a given world position, in meters.
 
|desc=The altitude above sea level of a given world position, in meters.
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=Bounds
 
|returntype=Bounds
 
|returndesc=
 
|returndesc=
 
|name=getBounds
 
|name=getBounds
|desc=Looks like a sphere for detecting potential collisions. Has a radius substantially larger than the body's radius&mdash;presumably to account for terrain and atmospheric height plus a safety margin.
+
|desc=Collision sphere; larger than body, presumably to account for terrain height, atmospheric height and safety margin.
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=double
 
|returntype=double
Line 197: Line 294:
 
|desc=The latitude of a given world position, in degrees.
 
|desc=The latitude of a given world position, in degrees.
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=double
 
|returntype=double
Line 202: Line 300:
 
|name=GetLongitude
 
|name=GetLongitude
 
|args={{arg|Vector3d|worldPos}}
 
|args={{arg|Vector3d|worldPos}}
|desc=The longitude of a given world position, in degrees.  The returned value doesn't seem to stay in any particular range.  It may be > 360 or < 0.  You'll probably want to do some modulo arithmetic to force this into a certain range like -180 to 180 or 0 to 360.
+
|desc=The longitude of a given world position, in degrees; value may be > 360 or < 0, you should modulo-reduce to an appropriate range (e.g. -180:180 or 0:360).
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=string
 
|returntype=string
Line 210: Line 309:
 
|desc=Same as <code>name</code> property.
 
|desc=Same as <code>name</code> property.
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=Vector3
 
|returntype=Vector3
Line 215: Line 315:
 
|desc=Infinite loop? (version 0.23.5)
 
|desc=Infinite loop? (version 0.23.5)
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=Orbit
 
|returntype=Orbit
Line 220: Line 321:
 
|desc=Same as <code>orbit</code>.
 
|desc=Same as <code>orbit</code>.
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=OrbitDriver
 
|returntype=OrbitDriver
Line 225: Line 327:
 
|desc=Same as <code>orbitDriver</code>.
 
|desc=Same as <code>orbitDriver</code>.
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=Vector3d
 
|returntype=Vector3d
Line 232: Line 335:
 
|desc=Converts a world position into a body-relative position?
 
|desc=Converts a world position into a body-relative position?
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=Vector3d
 
|returntype=Vector3d
Line 238: Line 342:
 
|desc=Returns position in body-relative coordinates for a given longitude/latitude/altitude. Same as GetSurfaceNVector * (body radius + alt).
 
|desc=Returns position in body-relative coordinates for a given longitude/latitude/altitude. Same as GetSurfaceNVector * (body radius + alt).
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=Vector3d
 
|returntype=Vector3d
Line 245: Line 350:
 
|desc=The reference frame of the planet's surface rotates with respect to an inertial reference frame. For example, a ship landed on the planet's surface is actually moving with respect to an inertial frame, because the planet is rotating. This function gives the difference between a velocity in the rotating frame and the same velocity in the inertial frame. You can use it to convert an inertial frame velocity (like the one returned by <code>Orbit.GetVel()</code>) to a rotating frame velocity by (rotating frame velocity) = (inertial frame velocity) - <code>body.GetRFrmVel(position)</code>.
 
|desc=The reference frame of the planet's surface rotates with respect to an inertial reference frame. For example, a ship landed on the planet's surface is actually moving with respect to an inertial frame, because the planet is rotating. This function gives the difference between a velocity in the rotating frame and the same velocity in the inertial frame. You can use it to convert an inertial frame velocity (like the one returned by <code>Orbit.GetVel()</code>) to a rotating frame velocity by (rotating frame velocity) = (inertial frame velocity) - <code>body.GetRFrmVel(position)</code>.
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=Vector3d
 
|returntype=Vector3d
Line 250: Line 356:
 
|desc=Always returns a zero vector. (as of version 0.23.5)
 
|desc=Always returns a zero vector. (as of version 0.23.5)
 
}}
 
}}
 +
 
{{Method
 
{{Method
 
|returntype=Vector3d
 
|returntype=Vector3d
Line 257: Line 364:
 
|desc=Returns a unit vector that is normal to the sphere of the planet at the given latitude and longitude. (Tells you which way is "up" at a given point on the planet.)
 
|desc=Returns a unit vector that is normal to the sphere of the planet at the given latitude and longitude. (Tells you which way is "up" at a given point on the planet.)
 
}}
 
}}
 +
 
{{Method|returntype=Transform|name=GetTransform|desc=Same as <code>bodyTransform</code> field}}
 
{{Method|returntype=Transform|name=GetTransform|desc=Same as <code>bodyTransform</code> field}}
 
{{Method
 
{{Method
Line 265: Line 373:
 
|desc=Returns the world position corresponding to a given latitude, longitude, and altitude above sea level.
 
|desc=Returns the world position corresponding to a given latitude, longitude, and altitude above sea level.
 
}}
 
}}
{{Method|returntype=bool|name=HasChild|args={{arg|CelestialBody|body}}|desc=True if the given body orbits this one. Doesn't seem to need to be a <i>direct</i> orbit&mdash;can be something that orbits something that orbits this. Inverse of <code>HasParent</code>.}}
+
 
{{Method|returntype=bool|name=HasParent|args={{arg|CelestialBody|body}}|desc=True if the given body orbits is orbited by this one. Doesn't seem to need to be a <i>direct</i> orbit&mdash;can be something that's orbited by something that's orbited by this. Inverse of <code>HasChild</code>.}}
+
{{Method
 +
|returntype=bool
 +
|name=HasChild
 +
|args={{arg|CelestialBody|body}}
 +
|desc=True if the given body orbits this one. Doesn't seem to need to be a <i>direct</i> orbit&mdash;can be something that orbits something that orbits this. Inverse of <code>HasParent</code>.
 +
}}
 +
 
 +
{{Method
 +
|returntype=bool
 +
|name=HasParent
 +
|args={{arg|CelestialBody|body}}
 +
|desc=True if the given body orbits is orbited by this one. Doesn't seem to need to be a <i>direct</i> orbit&mdash;can be something that's orbited by something that's orbited by this. Inverse of <code>HasChild</code>.
 +
}}
 +
 
 
{{MethodsEnd}}
 
{{MethodsEnd}}
  
 
[[Category:Community API Documentation]]
 
[[Category:Community API Documentation]]

Latest revision as of 23:44, 24 March 2019

CelestialBody Class

Inherits Implements
UnityEngine.MonoBehaviour ITargetable, IDiscoverable

A CelestialBody represents a planet, moon, or star that acts as a source of gravity and has some sphere of influence. You can find the CelestialBody whose sphere of influence you are currently in with the vessel.mainBody field.

Properties

The following are public properties available in CelestialBody.

Signature Description
DiscoveryInfo DiscoveryInfo { get; } ?
int flightsGlobalIndex { get; set; } The place the body has in the list FlightGlobals.Bodies
string name { get; } The name of the body, as it appears in e.g. the map view. Same as bodyName field.
Orbit orbit { get; } Contains all information about the body's orbit around whatever other body it is orbiting.
Vector3d position { get; set; } The position of the center of the body in world space.
CelestialBody referenceBody { get; } The celestial body that this one orbits.
Texture2D ResourceMap { get; } ?
PResource Resources { get; } ?
string theName { get; } Body's name preceded by appropriate article ("the" or nothing)


Fields

The following is a list of publically-accessible fields in CelestialBody. This includes protected items, which can be accessed by subclasses.

Signature Description
float altitudeMultiplier ?
float altitudeOffset ?
double angularV The magnitude of angularVelocity
Vector3d angularVelocity Similar to zUpAngularVelocity: Rotation vector, with y and z axes swapped


bool atmosphere Whether the body has an atmosphere
bool atmosphereContainsOxygen Whether oxygen is available (for jet engines)


Color atmosphericAmbientColor ?
Float atmosphereDepth ?
bool atmosphereUsePressureCurve ?
bool atmospherePressureCurveIsNormalized ?
float .atmospherePressureSeaLevel Pressure at sea level (atm)
Float atmosphereTemperatureLapseRate ?
Float atmosphereGasMassLapseRate ?
CBAttributeMap BiomeMap ?
string bodyName Same as the name property
Transform bodyTransition ?
CelestialBodyType bodyType ?
double directRotAngle ?
double GeeASL Gravity At Sea Level; in multiple of g (aka “gees”) the gravity at sea level on Kerbin, defined as 9.81 m/s²
double gMagnitudeAtCenter Same as gravParameter (below)
double gravParameter Gravitational parameter (G × Mass), computed as where g = 9.81.
double hillSphere Radius of body's Hill sphere computed as .
double initialRotation ?
bool inverseRotation ?
float inverseRotThresholdAltitude ?
double Mass body's mass (kg), computed as M = µ/G where µ is the body's gravitational parameter (gravParameter) and G=6.674e-11 N⋅m²⋅kg⁻² (instead of G=6.67384e-11 N⋅m²⋅kg⁻²)
double maxAtmosphereAltitude Used when useLegacyAtmosphere is False; atmosphere top altitude (m)
bool ocean ?
OrbitDriver orbitDriver ?
List<CelestialBody> orbitingBodies A list of all the bodies that orbit this one (e.g., the moons of a planet)
PQS pqsController An object that can give you information about the planet's terrain height as a function of position. See the documentation on the PQS class to see how to use it.
AnimationCurve pressureCurve Used when useLegacyAtmosphere is False; AnimationCurve mapping some altitudes (m) to pressure ratios (atm); actual pressure is obtained by multiplying by pressureMultiplier
float pressureMultiplier Used when useLegacyAtmosphere is False; linear factor in pressure (non-zero only on Kerbol, where it is set to 1000000)
double Radius The radius of the planet in meters. This defines sea level.
bool rotates ?
QuaternionD rotation ?
double rotationAngle The current angle of the body's rotation
double rotationPeriod How long it takes the planet to revolve once about its axis, in seconds.
CelestialBodyScienceParams scienceValues ?
double sphereOfInfluence Radius of the body's sphere of influence (m); measured from the center of the planet, not from sea level.
double staticPressureASL  ?; 21.46 on Kerbol, 1 everywhere else
AnimationCurve temperatureCurve ?
PlanetQuadTreeController terrainController ?
bool tidallyLocked Whether the body is tidally locked to its primary (its rotational period is its orbital period)
array of float timeWarpAltitudeLimits ?
bool useLegacyAtmosphere If True, then atmospheric pressure is based on scale height and atmosphere height threshold is a millionth of sea level pressure. Currently set to True for all bodies with an atmosphere.
bool use_The_InName Whether the body's name should be preceded by "the" in a sentence (e.g. "The Sun is pretty hot")
Vector3d zUpAngularVelocity Rotation vector

Methods

The following are methods included in CelestialBody.

Signature Description
double GetAltitude(Vector3d worldPos) The altitude above sea level of a given world position, in meters.
Bounds getBounds() Collision sphere; larger than body, presumably to account for terrain height, atmospheric height and safety margin.
double GetLatitude(Vector3d worldPos) The latitude of a given world position, in degrees.
double GetLongitude(Vector3d worldPos) The longitude of a given world position, in degrees; value may be > 360 or < 0, you should modulo-reduce to an appropriate range (e.g. -180:180 or 0:360).
string GetName() Same as name property.
Vector3 GetObtVelocity() Infinite loop? (version 0.23.5)
Orbit GetOrbit() Same as orbit.
OrbitDriver GetOrbitDriver() Same as orbitDriver.
Vector3d GetRelSurfacePosition(Vector3d worldPosition) Converts a world position into a body-relative position?
Vector3d GetRelSurfacePosition(double lat, double lon, double alt) Returns position in body-relative coordinates for a given longitude/latitude/altitude. Same as GetSurfaceNVector * (body radius + alt).
Vector3d getRFrmVel(Vector3d worldPos) The reference frame of the planet's surface rotates with respect to an inertial reference frame. For example, a ship landed on the planet's surface is actually moving with respect to an inertial frame, because the planet is rotating. This function gives the difference between a velocity in the rotating frame and the same velocity in the inertial frame. You can use it to convert an inertial frame velocity (like the one returned by Orbit.GetVel()) to a rotating frame velocity by (rotating frame velocity) = (inertial frame velocity) - body.GetRFrmVel(position).
Vector3d GetSrfVelocity() Always returns a zero vector. (as of version 0.23.5)
Vector3d GetSurfaceNVector(double lat, double lon) Returns a unit vector that is normal to the sphere of the planet at the given latitude and longitude. (Tells you which way is "up" at a given point on the planet.)
Transform GetTransform() Same as bodyTransform field
Vector3d GetWorldSurfacePosition(double lat, double lon, double alt) Returns the world position corresponding to a given latitude, longitude, and altitude above sea level.
bool HasChild(CelestialBody body) True if the given body orbits this one. Doesn't seem to need to be a direct orbit—can be something that orbits something that orbits this. Inverse of HasParent.
bool HasParent(CelestialBody body) True if the given body orbits is orbited by this one. Doesn't seem to need to be a direct orbit—can be something that's orbited by something that's orbited by this. Inverse of HasChild.