Skip to content

Latest commit

 

History

History
140 lines (120 loc) · 6.49 KB

globals.mkd

File metadata and controls

140 lines (120 loc) · 6.49 KB

Globals

Kerbulator aims to supply the user to all readings provided by the various instruments in the cockpit and the map view of vanilla KSP. I feel it strikes a good balance between giving not to little and not too much precalculated information. This balance is important to keep the game fun.

This document describes the various variables that are defined as 'global', meaning you can use them in any function without having to initialize them yourself. You can however at any point in your function overwrite them with your own value and they will keep this value for the remainder of the current function (but not in other functions: the scope is local.) For example, Kerbulator provides the mass of the planet you are currently orbiting:

out: x "The original value of Parent.M"
out: y "A new value for Parent.M"

x = Parent.M # The mass of the parent body we're orbiting
Parent.M = 10 # Overwrite the value with our own
y = Parent.M

Some useful constants

Name Description
pi Mathematical constant Pi: 3.14159265359
π Same as pi
e Mathematical constant e: 2.71828182846
G Graviational constant: 6.67384 × 10^(-11)
Inf Positive infinity
Same as Inf

Information about the world

Name Description
UT Seconds since epoch (AKA universal time)
MissionTime Seconds since vehicle launch (AKA mission time)

Information about various orbits

Kerbulator has globals that correspond to all the information KSP gives the player about orbits for the following bodies. In the table below, replace {body} with the name of the body you wish to obtain information about.

Name Description
{body}.Ap Altitude (to sea-level of parent body) of the apoapsis
{body}.Pe Altitude (to sea-level of parent body) of the periapsis
{body}.Alt Altitude of this body above sea-level of parent body
{body}.ArgPe Argument of periapsis (angle between the periapsis and ascending node)
{body}.ω Same as {body}.ArgPe
{body}.LAN The longitude of the ascending node
{body}.Ω Same as {body}.LAN
{body}.TimeToPe Time (in seconds) until the body will reach its periapsis
{body}.TimeToAp Time (in seconds) until the body will reach its apoapsis
{body}.Vel Current orbital velocity of the object
{body}.TrueAnomaly True anomaly (angle between the current position of the body and its periapsis)
{body}.θ Same as {body}.TrueAnomaly
{body}.Inc The inclination of the body

If there is a SOI change occuring in the orbit, these are defined as well:

Name Description
{body}.SOI.dt Time (in seconds) until SOI change
{body}.SOI.Δt Same as {body}.SOI.dt
{body}.SOI.TrueAnomaly True anomaly of the SOI change
{body}.SOI.θ Same as {body}.SOI.TrueAnomaly

Orbits are defined for the following bodies:

Name Description
Craft The craft you are currently flying
Target The body currently selected as your target
Kerbol The Sun, Kerbol
Moho Planet Moho
Eve Planet Eve
Gilly Moon Gilly
Kerbin Planet Kerbin
Mun Moon Mun
Minmus Moon Minmus
Duna Planet Duna
Ike Moon Ike
Dres Planet Dres
Jool Planet Jool
Laythe Moon Laythe
Vall Moon Vall
Tylo Moon Tylo
Bop Moon Bop
Pol Moon Pol
Eeloo Planet Eeloo

Information about celestial bodies

Apart from the orbits of the celestial bodies, some other information is provided as well. Replace {body} with the name of the celesial body you wish to obtain information about.

Name Description
{body}.R Radius of the body (in meters)
{body}.M Mass of the body (in kilograms)
{body}.mu Gravitational parameter (G*M) of the body
{body}.µ Same as mu
{body}.day Time (in seconds) it takes for the body to rotate around its axis
{body}.SOI Size (in meters) of the sphere of influence of the body
{body}.Vel Current orbital velocity of the object
{body}.AtmosHeight Height (in meters) of the atmosphere of the body (0 if it doesn't have one)
{body}.AtmosPress Pressure (in pascal) of the atmosphere of the body at sea level (0 if it doesn't have one)

Your navball

Name Description
Navball.Heading Your current heading of your vessel in degrees
Navball.Pitch The current pitch of your vessel in degrees
Navball.Roll The current roll of your vessel in degrees
Navball.OrbitalVelocity The current orbital velocity of your vessel in m/s
Navball.SurfaceVelocity The current velocity of your vessel relative to the surface of whatever you're orbiting in m/s
Navball.VerticalVelocity The current velocity of your vessel in the vertical direction, i.e. "up", i.e. away from whatever you are orbiting, in m/s

Information about a target

When a target is selected, some extra information about it is provided:

Name Description
Craft.Inter1.dt Time (in seconds) until the first time we cross the target orbit
Craft.Inter1.Δt Same as Craft.Inter1.dt
Craft.Inter1.Sep Distance (in meters) between our craft and the target at Craft.Inter1.dt
Craft.Inter1.TrueAnomaly True anomaly of the first time we cross the target orbit
Craft.Inter1.θ Same as Craft.Inter1.TrueAnomaly
Craft.Inter2.dt Time (in seconds) until the second time we cross the target orbit
Craft.Inter2.Δt Same as Craft.Inter1.dt
Craft.Inter2.Sep Distance (in meters) between our craft and the target at Craft.Inter2.dt
Craft.Inter2.TrueAnomaly True anomaly of the second time we cross the target orbit
Craft.Inter2.θ Same as Craft.Inter2.TrueAnomaly
Craft.Rel.AN True anomaly of ascending node relative to target
Craft.Rel.DN True anomaly of descenging node relative to target
Craft.Rel.Inc Inclination relative to target