Difference between revisions of "API:CelestialBody"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (top)
Line 1: Line 1:
{{class
 
|name=CelestialBody
 
|summary=A CelestialBody represents a [[Celestials|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 <code>vessel.mainBody</code> field.
 
|inherits=UnityEngine.MonoBehaviour
 
|implements=ITargetable, IDiscoverable
 
}}
 
  
{{PropertiesStart}}
 
{{Property
 
|type=DiscoveryInfo
 
|name=DiscoveryInfo
 
|hasget=1
 
}}
 
 
{{Property
 
|type=int
 
|name=flightsGlobalIndex
 
|hasget=1
 
|hasset=1
 
}}
 
 
{{Property
 
|type=string
 
|name=name
 
|hasget=1
 
|desc=The name of the body, as it appears in e.g. the map view. Same as <code>bodyName</code> field.
 
}}
 
 
{{Property
 
|type=Orbit
 
|name=orbit
 
|hasget=1
 
|desc=Contains all information about the body's orbit around whatever other body it is orbiting.
 
}}
 
 
{{Property
 
|type=Vector3d
 
|name=position
 
|hasget=1
 
|hasset=1
 
|desc=The position of the center of the body in world space.
 
}}
 
 
{{Property
 
|type=CelestialBody
 
|name=referenceBody
 
|hasget=1
 
|desc=The celestial body that this one orbits.
 
}}
 
 
{{Property
 
|type=Texture2D
 
|name=ResourceMap
 
|hasget=1
 
}}
 
 
{{Property
 
|type=PResource
 
|name=Resources
 
|hasget=1
 
}}
 
 
{{Property
 
|type=string
 
|name=theName
 
|hasget=1
 
|desc=Body's name preceded by appropriate article ("the" or nothing)
 
}}
 
 
{{PropertiesEnd}}
 
 
 
 
{{FieldsStart}}
 
 
{{Field|type=float|name=altitudeMultiplier}}
 
{{Field|type=float|name=altitudeOffset}}
 
 
{{Field
 
|type=double
 
|name=angularV
 
|desc=The magnitude of <code>angularVelocity</code>
 
}}
 
 
{{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=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=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=string
 
|name=bodyName
 
|desc=Same as the <code>name</code> property
 
}}
 
 
{{Field|type=Transform|name=bodyTransition}}
 
 
{{Field|type=CelestialBodyType|name=bodyType}}
 
 
{{Field|type=double|name=directRotAngle}}
 
 
{{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=Same as <code>gravParameter</code> (below)
 
}}
 
 
{{Field
 
|type=double
 
|name=gravParameter
 
|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=initialRotation}}
 
 
{{Field|type=bool|name=inverseRotation}}
 
 
{{Field|type=float|name=inverseRotThresholdAltitude}}
 
 
{{Field
 
|type=double
 
|name=Mass
 
|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
 
|type=double
 
|name=maxAtmosphereAltitude
 
|desc=Used when useLegacyAtmosphere is False; atmosphere top altitude (m)
 
}}
 
 
{{Field|type=bool|name=ocean}}
 
 
{{Field|type=OrbitDriver|name=orbitDriver}}
 
 
{{FieldTemplate
 
|type=List
 
|templateType=CelestialBody
 
|name=orbitingBodies
 
|desc=A list of all the bodies that orbit this one (e.g., the moons of a planet)
 
}}
 
 
{{Field
 
|type=PQS
 
|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 <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=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
 
|type=double
 
|name=Radius
 
|desc=The radius of the planet in meters. This defines sea level.
 
 
}}
 
{{Field|type=bool|name=rotates}}
 
 
{{Field|type=QuaternionD|name=rotation}}
 
 
{{Field
 
|type=double
 
|name=rotationAngle
 
|desc=The current angle of the body's rotation
 
}}
 
 
{{Field
 
|type=double
 
|name=rotationPeriod
 
|desc=How long it takes the planet to revolve once about its axis, in seconds.
 
}}
 
 
{{Field|type=CelestialBodyScienceParams|name=scienceValues}}
 
 
{{Field
 
|type=double
 
|name=sphereOfInfluence
 
|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=AnimationCurve|name=temperatureCurve}}
 
 
{{Field|type=PlanetQuadTreeController|name=terrainController}}
 
 
{{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=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
 
|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]]
 
}}
 
 
{{FieldsEnd}}
 
{{MethodsStart}}
 
{{Method
 
|returntype=double
 
|returndesc=
 
|name=GetAltitude
 
|args={{arg|Vector3d|worldPos}}
 
|desc=The altitude above sea level of a given world position, in meters.
 
}}
 
 
{{Method
 
|returntype=Bounds
 
|returndesc=
 
|name=getBounds
 
|desc=Collision sphere; larger than body, presumably to account for terrain height, atmospheric height and safety margin.
 
}}
 
 
{{Method
 
|returntype=double
 
|returndesc=
 
|name=GetLatitude
 
|args={{arg|Vector3d|worldPos}}
 
|desc=The latitude of a given world position, in degrees.
 
}}
 
 
{{Method
 
|returntype=double
 
|returndesc=
 
|name=GetLongitude
 
|args={{arg|Vector3d|worldPos}}
 
|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
 
|returntype=string
 
|returndesc=
 
|name=GetName
 
|desc=Same as <code>name</code> property.
 
}}
 
 
{{Method
 
|returntype=Vector3
 
|name=GetObtVelocity
 
|desc=Infinite loop? (version 0.23.5)
 
}}
 
 
{{Method
 
|returntype=Orbit
 
|name=GetOrbit
 
|desc=Same as <code>orbit</code>.
 
}}
 
 
{{Method
 
|returntype=OrbitDriver
 
|name=GetOrbitDriver
 
|desc=Same as <code>orbitDriver</code>.
 
}}
 
 
{{Method
 
|returntype=Vector3d
 
|returndesc=
 
|name=GetRelSurfacePosition
 
|args={{arg|Vector3d|worldPosition}}
 
|desc=Converts a world position into a body-relative position?
 
}}
 
 
{{Method
 
|returntype=Vector3d
 
|name=GetRelSurfacePosition
 
|args={{arg|double|lat}}, {{arg|double|lon}}, {{arg|double|alt}}
 
|desc=Returns position in body-relative coordinates for a given longitude/latitude/altitude. Same as GetSurfaceNVector * (body radius + alt).
 
}}
 
 
{{Method
 
|returntype=Vector3d
 
|returndesc=
 
|name=getRFrmVel
 
|args={{arg|Vector3d|worldPos}}
 
|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
 
|returntype=Vector3d
 
|name=GetSrfVelocity
 
|desc=Always returns a zero vector. (as of version 0.23.5)
 
}}
 
 
{{Method
 
|returntype=Vector3d
 
|returndesc=
 
|name=GetSurfaceNVector
 
|args={{arg|double|lat}}, {{arg|double|lon}}
 
|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=Vector3d
 
|returndesc=
 
|name=GetWorldSurfacePosition
 
|args={{arg|double|lat}}, {{arg|double|lon}}, {{arg|double|alt}}
 
|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>.
 
}}
 
 
{{MethodsEnd}}
 
 
[[Category:Community API Documentation]]
 

Revision as of 17:44, 17 March 2017