Difference between revisions of "API:CelestialBody"
From Kerbal Space Program Wiki
(Add interfaces) |
(added public fields) |
||
Line 21: | Line 21: | ||
|name=name | |name=name | ||
|hasget=1 | |hasget=1 | ||
− | |desc=The name of the body, as it appears in e.g. the map view. | + | |desc=The name of the body, as it appears in e.g. the map view. Same as <code>bodyName</code> field. |
}} | }} | ||
{{Property | {{Property | ||
Line 27: | Line 27: | ||
|name=orbit | |name=orbit | ||
|hasget=1 | |hasget=1 | ||
− | |desc= | + | |desc=Contains all information about the body's orbit around whatever other body it is orbiting. |
}} | }} | ||
{{Property | {{Property | ||
Line 56: | Line 56: | ||
|name=theName | |name=theName | ||
|hasget=1 | |hasget=1 | ||
− | |desc=(not confirmed) Same as <code> | + | |desc=(not confirmed) Same as <code>name</code> except prefixed with "the " (if appropriate) |
}} | }} | ||
{{PropertiesEnd}} | {{PropertiesEnd}} | ||
{{FieldsStart}} | {{FieldsStart}} | ||
+ | {{Field|type=float|name=altitudeMultiplier}} | ||
+ | {{Field|type=float|name=altitudeOffset}} | ||
+ | |||
+ | {{Field|type=double|name=angularV}} | ||
+ | {{Field|type=Vector3d|name=angularVelocity}} | ||
+ | {{Field|type=float|name=atmosphereTemperatureMultiplier}} | ||
+ | {{Field|type=bool|name=atmosphere}} | ||
+ | |||
+ | {{Field|type=bool|name=atmosphereContainsOxygen}} | ||
+ | |||
+ | {{Field|type=float|name=atmosphereMultiplier}} | ||
+ | |||
+ | {{Field|type=double|name=atmosphereScaleHeight}} | ||
+ | |||
+ | {{Field|type=Color|name=atmosphericAmbientColor}} | ||
+ | |||
+ | {{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=Force of gravity at sea level?}} | ||
+ | |||
+ | {{Field|type=double|name=gMagnitudeAtCenter}} | ||
+ | |||
{{Field | {{Field | ||
|type=double | |type=double | ||
− | |name= | + | |name=gravParamter |
− | |desc= | + | |desc=This is probably equal to G * Mass? |
+ | |||
}} | }} | ||
+ | {{Field|type=double|name=hillSphere}} | ||
+ | |||
+ | {{Field|type=double|name=initialRotation}} | ||
+ | |||
+ | {{Field|type=bool|name=inverseRotation}} | ||
+ | |||
+ | {{Field|type=float|name=inverseRotThresholdAltitude}} | ||
+ | |||
{{Field | {{Field | ||
|type=double | |type=double | ||
− | |name= | + | |name=Mass |
− | |desc= | + | |desc=the mass of the body, in KSP's arbitrary mass units. For calculating gravity, KSP seems to use a gravitational constant of G = 6.674E-11 (SI units), which is the same as the real one rounded to 3 decimal places. |
+ | |||
}} | }} | ||
{{Field | {{Field | ||
Line 75: | Line 115: | ||
|desc=The height above sea level at which the atmosphere ends, in meters. | |desc=The height above sea level at which the atmosphere ends, in meters. | ||
}} | }} | ||
− | {{Field | + | {{Field|type=bool|name=ocean}} |
− | |type= | + | |
− | |name= | + | {{Field|type=OrbitDriver|name=orbitDriver}} |
− | | | + | |
− | }} | ||
{{FieldTemplate | {{FieldTemplate | ||
|type=List | |type=List | ||
Line 85: | Line 124: | ||
|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 | ||
Line 91: | Line 131: | ||
|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 PQS class to see how to use it. | ||
}} | }} | ||
+ | {{Field|type=AnimationCurve|name=pressureCurve}} | ||
+ | |||
+ | {{Field|type=float|name=pressureMultiplier}} | ||
+ | |||
{{Field | {{Field | ||
|type=double | |type=double | ||
|name=Radius | |name=Radius | ||
|desc=The radius of the planet in meters. This defines sea level. | |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}} | ||
+ | |||
{{Field | {{Field | ||
|type=double | |type=double | ||
|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 | {{Field | ||
|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=The radius of the body's sphere of influence, in meters, measured from the center of the planet (not sea level). | ||
+ | |||
}} | }} | ||
+ | {{Field|type=double|name=staticPressureASL}} | ||
+ | |||
+ | {{Field|type=AnimationCurve|name=temperatureCurve}} | ||
+ | |||
+ | {{Field|type=PlanetQuadTreeController|name=terrainController}} | ||
+ | |||
+ | {{Field|type=bool|name=tidallyLocked}} | ||
+ | |||
+ | {{Field|type=array of float|name=timeWarpAltitudeLimits}} | ||
+ | |||
+ | {{Field|type=bool|name=useLegacyAtmosphere}} | ||
+ | |||
+ | {{Field|type=bool|name=use_The_InName|When true, the <code>theName</code> property will include "the " in the body's name}} | ||
+ | |||
+ | {{Field|type=Vector3d|name=zUpAngularVelocity}} | ||
{{FieldsEnd}} | {{FieldsEnd}} | ||
{{MethodsStart}} | {{MethodsStart}} |
Revision as of 02:18, 13 June 2014
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; } | ? |
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; } | (not confirmed) The celestial body that this one orbits. |
Texture2D ResourceMap { get; } | ? |
PResource Resources { get; } | ? |
string theName { get; } | (not confirmed) Same as name except prefixed with "the " (if appropriate)
|
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 | ? |
Vector3d angularVelocity | ? |
float atmosphereTemperatureMultiplier | ? |
bool atmosphere | ? |
bool atmosphereContainsOxygen | ? |
float atmosphereMultiplier | ? |
double atmosphereScaleHeight | ? |
Color atmosphericAmbientColor | ? |
CBAttributeMap BiomeMap | ? |
string bodyName | Same as the name property
|
Transform bodyTransition | ? |
CelestialBodyType bodyType | ? |
double directRotAngle | ? |
double GeeASL | Force of gravity at sea level? |
double gMagnitudeAtCenter | ? |
double gravParamter | This is probably equal to G * Mass? |
double hillSphere | ? |
double initialRotation | ? |
bool inverseRotation | ? |
float inverseRotThresholdAltitude | ? |
double Mass | the mass of the body, in KSP's arbitrary mass units. For calculating gravity, KSP seems to use a gravitational constant of G = 6.674E-11 (SI units), which is the same as the real one rounded to 3 decimal places. |
double maxAtmosphereAltitude | The height above sea level at which the atmosphere ends, in meters. |
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 | ? |
float pressureMultiplier | ? |
double Radius | The radius of the planet in meters. This defines sea level. |
bool rotates | ? |
QuaternionD rotation | ? |
double rotationAngle | ? |
double rotationPeriod | How long it takes the planet to revolve once about its axis, in seconds. |
CelestialBodyScienceParams scienceValues | ? |
double sphereOfInfluence | The radius of the body's sphere of influence, in meters, measured from the center of the planet (not sea level). |
double staticPressureASL | ? |
AnimationCurve temperatureCurve | ? |
PlanetQuadTreeController terrainController | ? |
bool tidallyLocked | ? |
array of float timeWarpAltitudeLimits | ? |
bool useLegacyAtmosphere | ? |
bool use_The_InName | ? |
Vector3d zUpAngularVelocity | ? |
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. |
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. 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. |
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 GetSurfaceNVector(double lat, double lon) | Returns a unit vector that is normal to the sphere of the planet at the given latitude and longitude. |
Vector3d GetWorldSurfacePosition(double lat, double lon, double alt) | Probably this returns the world position corresponding to a given latitude, longitude, and altitude above sea level? |