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

FlightGlobals contains lists of all CelestialBodies and Vessels in the game. It also provides static utility functions for computing the atmospheric and gravitational properties of CelestialBodies. More...

Inheritance diagram for FlightGlobals:

Public Types

enum  VesselTargetModes { VesselTargetModes.None = 0, VesselTargetModes.Direction = 1, VesselTargetModes.DirectionAndVelocity = 2, VesselTargetModes.DirectionVelocityAndOrientation = 3 }
 

Public Member Functions

 FlightGlobals ()
 
Quaternion getFoR (FoRModes mode)
 
void SetShipOrbit (int selBodyIndex, double ecc, double sma, double inc, double LAN, double mna, double argPe, double ObT)
 
void SetVesselTarget (ITargetable tgt)
 Sets the currently selected target vessel, celestial body, or docking node More...
 
void Start ()
 

Static Public Member Functions

static void addPhysicalObject (GameObject pObject)
 
static ClearToSaveStatus ClearToSave ()
 
static void ForceSetActiveVessel (Vessel v)
 
static float getAltitudeAtPos (Vector3 position)
 The altitude above the sea level of the current main body of the given world space position. More...
 
static double getAltitudeAtPos (Vector3d position)
 The altitude above the sea level of the current main body of the given world space position. More...
 
static double getAltitudeAtPos (Vector3d position, CelestialBody body)
 The altitude above the sea level of the given body of the given world space position. More...
 
static double getAtmDensity (double pressure)
 Converts an atmospheric pressure into an atmospheric density. Atmospheric density is what appears in the KSP drag equation. This function seems to just multiply the input by 1.2230948554874 More...
 
static Vector3d getCentrifugalAcc (Vector3d pos, CelestialBody body)
 
static Vector3d getCoriolisAcc (Vector3d vel, CelestialBody body)
 
static float getExternalTemperature (Vector3d pos)
 Finds the temperature at a given world space position. More...
 
static float getExternalTemperature (float altitude, CelestialBody body)
 Finds the temperature at a given altitude above a given body. More...
 
static Quaternion GetFoR (FoRModes mode)
 
static Vector3d getGeeForceAtPosition (Vector3d pos)
 Returns the gravitational acceleration vector at a given position. Contrary to its name, it does not return force. More...
 
static CelestialBody getMainBody ()
 Returns the current dominant body? More...
 
static CelestialBody getMainBody (Vector3d refPos)
 Returns the body whose sphere of influence contains a given position? More...
 
static double getStaticPressure ()
 Returns the current atmospheric pressure? More...
 
static double getStaticPressure (Vector3d position)
 Returns the atmospheric pressure at a given position. Feed the output of this function into getAtmDensity to get the atmopsheric density. More...
 
static double getStaticPressure (double altitude, CelestialBody body=null)
 Returns the atmospheric pressure at a given altitude above a given body More...
 
static double getStaticPressure (Vector3d position, CelestialBody body)
 Returns the atmospheric pressure of a given body's atmopshere at a given position More...
 
static Vector3d getUpAxis ()
 
static Vector3d getUpAxis (Vector3d position)
 
static void removePhysicalObject (GameObject pObject)
 
static void SetActiveVessel (Vessel v)
 

Public Attributes

Vessel activeVessel
 
List< CelestialBodybodies
 
float drag_multiplier
 
Camera mainCameraRef
 
List< Vesselvessels
 
Vector3 vesselTargetDelta
 
Vector3 vesselTargetDirection
 
Transform vesselTargetTransform
 

Static Public Attributes

static Part activeTarget
 
static double camera_altitude
 
static Vector3d camera_position
 
static CelestialBody currentMainBody
 
static FlightGlobals fetch
 Use this FlightGlobals instance to access non-static members of FlightGlobals. For example, the current target is FlightGlobals.fetch.VesselTarget. More...
 
static FoRModes FoRMode
 
static bool overrideOrbit
 
static List< GameObject > physicalObjects
 
static bool ready
 
static Vector3d ship_acceleration
 
static double ship_altitude
 
static Vector3 ship_angularMomentum
 
static Vector3d ship_angularVelocity
 
static Vector3d ship_CoM
 
static double ship_dns
 
static double ship_geeForce
 
static float ship_heading
 
static double ship_latitude
 
static double ship_longitude
 
static Vector3 ship_MOI
 
static double ship_obtSpeed
 
static Vector3d ship_obtVelocity
 
static Orbit ship_orbit
 
static Quaternion ship_orientation
 
static Quaternion ship_orientation_offset
 
static Vector3d ship_position
 
static Quaternion ship_rotation
 
static double ship_srfSpeed
 
static Vector3d ship_srfVelocity
 
static double ship_stP
 
static double ship_tgtSpeed
 
static Vector3d ship_tgtVelocity
 
static Vector3d ship_upAxis
 
static Vector3d ship_velocity
 
static double ship_verticalSpeed
 
static bool warpDriveActive
 

Properties

static Vessel ActiveVessel [get]
 The vessel the player is currently controlling. More...
 
static List< CelestialBodyBodies [get]
 A list of all CelestialBodies in the universe. Contents in 0.18.2: More...
 
static float DragMultiplier [get]
 The KSP formula for the drag force on a part is (1/2) * DragMultiplier * part.mass * part.mass_drag * airspeed^2 More...
 
static bool RefFrameIsRotating [get]
 Whether KSP is doing its computations in an inertial reference frame, or the reference frame that rotates with the current dominant celestial body. More...
 
static Vector3d upAxis [get]
 
static float vacuumTemperature [get]
 
static List< VesselVessels [get]
 A list of all the Vessels that currently exist More...
 
ITargetable VesselTarget [get]
 The currently selected target vessel, celestial body, or docking node. If no target is selected, this is null. More...
 
FlightGlobals.VesselTargetModes vesselTargetMode [get]
 

Detailed Description

FlightGlobals contains lists of all CelestialBodies and Vessels in the game. It also provides static utility functions for computing the atmospheric and gravitational properties of CelestialBodies.

Member Enumeration Documentation

Enumerator
None 
Direction 
DirectionAndVelocity 
DirectionVelocityAndOrientation 

Constructor & Destructor Documentation

FlightGlobals.FlightGlobals ( )

Member Function Documentation

static void FlightGlobals.addPhysicalObject ( GameObject  pObject)
static
static ClearToSaveStatus FlightGlobals.ClearToSave ( )
static
static void FlightGlobals.ForceSetActiveVessel ( Vessel  v)
static
static float FlightGlobals.getAltitudeAtPos ( Vector3  position)
static

The altitude above the sea level of the current main body of the given world space position.

Parameters
positionWorld space position
Returns
Altitude above sea level
static double FlightGlobals.getAltitudeAtPos ( Vector3d  position)
static

The altitude above the sea level of the current main body of the given world space position.

Parameters
positionWorld space position
Returns
Altitude above sea level
static double FlightGlobals.getAltitudeAtPos ( Vector3d  position,
CelestialBody  body 
)
static

The altitude above the sea level of the given body of the given world space position.

Parameters
positionWorld space position
bodyThe body in question
Returns
Altitude above sea level
static double FlightGlobals.getAtmDensity ( double  pressure)
static

Converts an atmospheric pressure into an atmospheric density. Atmospheric density is what appears in the KSP drag equation. This function seems to just multiply the input by 1.2230948554874

Parameters
pressureUse the output of getStaticPressure
Returns
An atmospheric density, suitable for use in calculating drag.
static Vector3d FlightGlobals.getCentrifugalAcc ( Vector3d  pos,
CelestialBody  body 
)
static
static Vector3d FlightGlobals.getCoriolisAcc ( Vector3d  vel,
CelestialBody  body 
)
static
static float FlightGlobals.getExternalTemperature ( Vector3d  pos)
static

Finds the temperature at a given world space position.

Parameters
posWorld space position
Returns
Temperature
static float FlightGlobals.getExternalTemperature ( float  altitude,
CelestialBody  body 
)
static

Finds the temperature at a given altitude above a given body.

Parameters
altitudeAn altitude (in meters?)
bodyThe body of interest
Returns
Temperture
static Quaternion FlightGlobals.GetFoR ( FoRModes  mode)
static
Quaternion FlightGlobals.getFoR ( FoRModes  mode)
static Vector3d FlightGlobals.getGeeForceAtPosition ( Vector3d  pos)
static

Returns the gravitational acceleration vector at a given position. Contrary to its name, it does not return force.

Parameters
posWorld space position
Returns
Gravitational acceleration vector
static CelestialBody FlightGlobals.getMainBody ( )
static

Returns the current dominant body?

Returns
static CelestialBody FlightGlobals.getMainBody ( Vector3d  refPos)
static

Returns the body whose sphere of influence contains a given position?

Parameters
refPosWorld space position?
Returns
static double FlightGlobals.getStaticPressure ( )
static

Returns the current atmospheric pressure?

Returns
Atmospheric pressure, in units of Kerbin's atmospheric pressure at sea level
static double FlightGlobals.getStaticPressure ( Vector3d  position)
static

Returns the atmospheric pressure at a given position. Feed the output of this function into getAtmDensity to get the atmopsheric density.

Parameters
positionWorld space position
Returns
Atmospheric pressure, in units of Kerbin's atmospheric pressure at sea level
static double FlightGlobals.getStaticPressure ( double  altitude,
CelestialBody  body = null 
)
static

Returns the atmospheric pressure at a given altitude above a given body

Parameters
altitudeAltitude in meters?
bodyThe body in question
Returns
Atmospheric pressure, in units of Kerbin's atmospheric pressure at sea level
static double FlightGlobals.getStaticPressure ( Vector3d  position,
CelestialBody  body 
)
static

Returns the atmospheric pressure of a given body's atmopshere at a given position

Parameters
positionWorld space position
bodyThe body in question
Returns
Atmospheric pressure, in units of Kerbin's atmospheric pressure at sea level
static Vector3d FlightGlobals.getUpAxis ( )
static
static Vector3d FlightGlobals.getUpAxis ( Vector3d  position)
static
static void FlightGlobals.removePhysicalObject ( GameObject  pObject)
static
static void FlightGlobals.SetActiveVessel ( Vessel  v)
static
void FlightGlobals.SetShipOrbit ( int  selBodyIndex,
double  ecc,
double  sma,
double  inc,
double  LAN,
double  mna,
double  argPe,
double  ObT 
)
void FlightGlobals.SetVesselTarget ( ITargetable  tgt)

Sets the currently selected target vessel, celestial body, or docking node

Parameters
tgtThe Vessel, CelestialBody, or ModuleDockingNode to target
void FlightGlobals.Start ( )

Member Data Documentation

Part FlightGlobals.activeTarget
static
Vessel FlightGlobals.activeVessel
List<CelestialBody> FlightGlobals.bodies
double FlightGlobals.camera_altitude
static
Vector3d FlightGlobals.camera_position
static
CelestialBody FlightGlobals.currentMainBody
static
float FlightGlobals.drag_multiplier
FlightGlobals FlightGlobals.fetch
static

Use this FlightGlobals instance to access non-static members of FlightGlobals. For example, the current target is FlightGlobals.fetch.VesselTarget.

FoRModes FlightGlobals.FoRMode
static
Camera FlightGlobals.mainCameraRef
bool FlightGlobals.overrideOrbit
static
List<GameObject> FlightGlobals.physicalObjects
static
bool FlightGlobals.ready
static
Vector3d FlightGlobals.ship_acceleration
static
double FlightGlobals.ship_altitude
static
Vector3 FlightGlobals.ship_angularMomentum
static
Vector3d FlightGlobals.ship_angularVelocity
static
Vector3d FlightGlobals.ship_CoM
static
double FlightGlobals.ship_dns
static
double FlightGlobals.ship_geeForce
static
float FlightGlobals.ship_heading
static
double FlightGlobals.ship_latitude
static
double FlightGlobals.ship_longitude
static
Vector3 FlightGlobals.ship_MOI
static
double FlightGlobals.ship_obtSpeed
static
Vector3d FlightGlobals.ship_obtVelocity
static
Orbit FlightGlobals.ship_orbit
static
Quaternion FlightGlobals.ship_orientation
static
Quaternion FlightGlobals.ship_orientation_offset
static
Vector3d FlightGlobals.ship_position
static
Quaternion FlightGlobals.ship_rotation
static
double FlightGlobals.ship_srfSpeed
static
Vector3d FlightGlobals.ship_srfVelocity
static
double FlightGlobals.ship_stP
static
double FlightGlobals.ship_tgtSpeed
static
Vector3d FlightGlobals.ship_tgtVelocity
static
Vector3d FlightGlobals.ship_upAxis
static
Vector3d FlightGlobals.ship_velocity
static
double FlightGlobals.ship_verticalSpeed
static
List<Vessel> FlightGlobals.vessels
Vector3 FlightGlobals.vesselTargetDelta
Vector3 FlightGlobals.vesselTargetDirection
Transform FlightGlobals.vesselTargetTransform
bool FlightGlobals.warpDriveActive
static

Property Documentation

Vessel FlightGlobals.ActiveVessel
staticget

The vessel the player is currently controlling.

List<CelestialBody> FlightGlobals.Bodies
staticget

A list of all CelestialBodies in the universe. Contents in 0.18.2:

Bodies[0] = Sun

Bodies[1] = Kerbin

Bodies[2] = Mun

Bodies[3] = Minmus

Bodies[4] = Moho

Bodies[5] = Eve

Bodies[6] = Dun

Bodies[7] = Ike

Bodies[8] = Jool

Bodies[9] = Laythe

Bodies[10] = Vall

Bodies[11] = Bop

Bodies[12] = Tylo

Bodies[13] = Gilly

Bodies[14] = Pol

Bodies[15] = Dres

Bodies[16] = Eeloo

float FlightGlobals.DragMultiplier
staticget

The KSP formula for the drag force on a part is (1/2) * DragMultiplier * part.mass * part.mass_drag * airspeed^2

bool FlightGlobals.RefFrameIsRotating
staticget

Whether KSP is doing its computations in an inertial reference frame, or the reference frame that rotates with the current dominant celestial body.

Vector3d FlightGlobals.upAxis
staticget
float FlightGlobals.vacuumTemperature
staticget
List<Vessel> FlightGlobals.Vessels
staticget

A list of all the Vessels that currently exist

ITargetable FlightGlobals.VesselTarget
get

The currently selected target vessel, celestial body, or docking node. If no target is selected, this is null.

FlightGlobals.VesselTargetModes FlightGlobals.vesselTargetMode
get

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