Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Properties | List of all members
FlightGlobals Class Reference

This class keeps all sorts of flight-related information that need to be accessed globally. Here are methods for sampling gravity, air pressure, temperature for any given flight state, as well as publicly available references to planet positions and other stuff. More...

Inheritance diagram for FlightGlobals:

Public Types

enum  SpeedDisplayModes { SpeedDisplayModes.Orbit, SpeedDisplayModes.Surface, SpeedDisplayModes.Target }
 

Public Member Functions

void SetShipOrbit (int selBodyIndex, double ecc, double sma, double inc, double LAN, double mna, double argPe, double ObT)
 
void SetShipOrbitRendezvous (Vessel target, Vector3d relPosition, Vector3d relVelocity)
 
void SetVesselPosition (int selBodyIndex, double latitude, double longitude, double altitude, double inclination, double heading, bool asl, bool easeToSurface=false, double gravityMultiplier=0.1)
 Sets a vessel to a Position More...
 
void SetVesselPosition (int selBodyIndex, double latitude, double longitude, double altitude, Vector3 rotation, bool asl, bool easeToSurface=false, double easeInMultiplier=0.1)
 Sets a vessel to a Position More...
 
void SetVesselTarget (ITargetable tgt, bool overrideInputLock=false)
 
void Start ()
 

Static Public Member Functions

static void addPhysicalObject (physicalObject pObject)
 
static void AddVessel (Vessel vessel)
 Adds a vessel to vessel lists and persistentVesselIds list. Will also add vessel Parts or protovessel protoPartsnapshot persistentIds into relevent lists. More...
 
static uint CheckPartpersistentId (uint persistentId, Part part, bool removeOldId, bool addNewId, uint vesselId=0u)
 Check the passed in persistentId if it is zero generate a new one. If it is non zero check it does not already exist on a part. If it Does exist, generate a new one and call GameEvent onPartpersistentIdChanged If removeOldId is true will remove old entry if a new one is generated. If addNewId is true will add new entry if a new one is generated. Finally it will add the persistentId if it wasn't found. More...
 
static uint CheckProtoPartSnapShotpersistentId (uint persistentId, ProtoPartSnapshot partSnapshot, bool removeOldId, bool addNewId)
 Check the passed in persistentId if it is zero generate a new one. If it is non zero check it does not already exist on a protopartsnapshot. If it Does exist, generate a new one and call GameEvent onPartpersistentIdChanged If removeOldId is true will remove old entry if a new one is generated. If addNewId is true will add new entry if a new one is generated. Finally it will add the persistentId if it wasn't found. More...
 
static uint CheckVesselpersistentId (uint persistentId, Vessel vessel, bool removeOldId, bool addNewId)
 Check the passed in persistentId if it is zero generate a new one. If it is non zero check it does not already exist on a vessel. If it Does exist, generate a new one and call GameEvent onVesselpersistentIdChanged If removeOldId is true will remove old entry if a new one is generated. If addNewId is true will add new entry if a new one is generated. Finally it will add the persistentId if it wasn't found. More...
 
static void ClearInverseRotation ()
 
static ClearToSaveStatus ClearToSave ()
 
static ClearToSaveStatus ClearToSave (bool logMsg)
 
static void CycleSpeedModes ()
 
static bool FindLoadedPart (uint id, out Part partout)
 Find a Loaded Part from persistentId More...
 
static Vessel FindNearestControllableVessel (Vessel currentVessel)
 Finds the nearest controllable vessel. Used for switching focus after the current vessel has died. More...
 
static List< VesselFindNearestVesselWhere (Vector3d refPos, Func< Vessel, bool > criteria)
 Returns a filtered, distance-sorted list (from refPos) of all vessels that pass the given criteria More...
 
static Part FindPartByID (uint flightID)
 Finds a part on any loaded vessels with the given flight ID. Will return null if no loaded part exists with that ID (even if it does exist but is unloaded). More...
 
static ProtoPartSnapshot FindProtoPartByID (uint flightID)
 Finds a protopart on any vessels (including unloaded ones) with the given flightID. More...
 
static bool FindUnloadedPart (uint id, out ProtoPartSnapshot partout)
 Find an UnloadedPart from persistentId More...
 
static Vessel FindVessel (Guid id)
 Find Vessel in vessels list by id (Guid) More...
 
static bool FindVessel (uint id, out Vessel vessel)
 Find a Vessel from persistentId More...
 
static bool ForceSetActiveVessel (Vessel v)
 Switch focus to another vessel, ignoring vessel-transition restrictions (use with caution). Will return false if sent to the same vessel, true on most other cases. More...
 
static double getAltitudeAtPos (Vector3d position)
 returns the altitude in relation to the main body at the specified position More...
 
static float getAltitudeAtPos (Vector3 position)
 
static float getAltitudeAtPos (Vector3 position, CelestialBody body)
 
static double getAltitudeAtPos (Vector3d position, CelestialBody body)
 
static double getAtmDensity (double pressure, double temperature, CelestialBody body=null)
 returns the atmospheric density from the given pressure level, More...
 
static CelestialBody GetBodyByName (string bodyName)
 
static int GetBodyIndex (CelestialBody body)
 
static Vector3d getCentrifugalAcc (Vector3d pos, CelestialBody body)
 Returns the centrifugal acceleration for the given position and reference body. (If the planet is not in reverse-rotation, there is no centrifugal force) More...
 
static CelestialBody GetCometPerturber ()
 Which body is used in Comet Orbit and type calculations More...
 
static int GetCometPerturberIndex ()
 Which body is used in Comet Orbit and type calculations More...
 
static string GetCometPerturberName ()
 Name of the body used in Comet Orbit and type calculations More...
 
static Vector3d getCoriolisAcc (Vector3d vel, CelestialBody body)
 Return the coriolis acceleration for the given velocity and reference body. (If the planet is not in reverse-rotation, there is no coriolis force) More...
 
static double GetDisplaySpeed ()
 
static Vector3d GetDisplayVelocity ()
 
static double getExternalTemperature ()
 returns the outside temperature for the specified position and celestial body More...
 
static double getExternalTemperature (double altitude, CelestialBody body=null)
 returns the outside temperature for the specified position and celestial body More...
 
static double getExternalTemperature (Vector3d pos, CelestialBody body=null)
 
static Quaternion GetFoR (FoRModes mode)
 
static Quaternion GetFoR (FoRModes mode, Transform referenceTransform)
 
static Quaternion GetFoR (FoRModes mode, Transform referenceTransform, Orbit orbit)
 
static Vector3d getGeeForceAtPosition (Vector3d pos)
 Returns a force vector for the gravity at the specified world position. use with rigidbody.addForce() (use acceleration force mode for gravity) note: returns the force for the dominant body only (gravitational pertubations not taken into account) More...
 
static Vector3d getGeeForceAtPosition (Vector3d pos, CelestialBody mainBody)
 Returns a force vector for the gravity at the specified world position. use with rigidbody.addForce() (use acceleration force mode for gravity) note: returns the force for the dominant body only (gravitational pertubations not taken into account) More...
 
static CelestialBody GetHomeBody ()
 
static string GetHomeBodyDisplayName ()
 
static int GetHomeBodyIndex ()
 
static string GetHomeBodyName ()
 
static CelestialBody getMainBody (Vector3d refPos)
 Returns a reference to the celestial with the highest gravitational influence at the specified position. More...
 
static CelestialBody getMainBody ()
 Returns a reference to the celestial with the highest gravitational influence on the active ship More...
 
static string GetNotClearToSaveStatusReason (ClearToSaveStatus status, string attempt)
 
static PartPointer GetPartPointerUpwardsCached (GameObject go)
 Finds and uses cached results of GetComponentUpwards<PartPointer> on the supplied game object NOTE: To reset the cache call ResetObjectPartPointerUpwardsCache More...
 
static Part GetPartUpwardsCached (GameObject go)
 Find the part component attached to the game object or its unity gameobject parents. More...
 
static double GetSqrAltitude (Vector3d position, CelestialBody body)
 
static double getStaticPressure (double altitude, CelestialBody body=null)
 returns the static atmospheric pressure (in kPa) at the specified altitude and celestial body More...
 
static double getStaticPressure (Vector3d position)
 returns the static atmospheric pressure in kPa at the specified position More...
 
static double getStaticPressure (Vector3d position, CelestialBody body)
 
static double getStaticPressure ()
 returns the static atmospheric pressure in kPa at the ship's position More...
 
static uint GetUniquepersistentId ()
 Generate a Unique PersistentId uint More...
 
static Vector3d getUpAxis ()
 
static Vector3d getUpAxis (Vector3d position)
 
static Vector3d getUpAxis (CelestialBody body, Vector3d position)
 
static string GGetCometPerturberDisplayName ()
 Display Name of the body used in Comet Orbit and type calculations More...
 
static void removePhysicalObject (physicalObject pObject)
 
static void RemoveVessel (Vessel vessel)
 Removes passed in vessel from the vessel lists and persistentId dictionaries. Will also remove vessel Parts or protovessel protoPartsnapshot persistentIds into relevent lists. More...
 
static void ResetObjectPartPointerUpwardsCache ()
 Resets the cache where we remember all of the parent PartPointer references associated with different game objects. Please call this if gameobjects are ever reparented in a way that would cause its parent part to change. More...
 
static void ResetObjectPartUpwardsCache ()
 Resets the cache where we remember all of the parent parts associated with different game objects. Please call this if gameobjects are ever reparented in a way that would cause its parent part to change. More...
 
static bool SetActiveVessel (Vessel v)
 Switch focus to another vessel. Returns true if successful, false if not. More...
 
static void SetSpeedMode (SpeedDisplayModes newSpeedMode)
 
static void SortVessel (Vessel vessel, bool loaded)
 Sorts a passed in vessel based on the loaded bool passed in. Moves Vessel into veselsUnloaded or vesselsLoaded dictionaries. Stores Vessel Parts persistentIds into persistentLoadedPartIds dictionary if loaded or stores Vessel protovessel protoPartSnapshots persistentIds into persistentUnloadedPartIds dictionary if not loaded More...
 

Public Attributes

Vessel activeVessel
 
List< CelestialBodybodies = new List<CelestialBody>()
 
Camera mainCameraRef
 
DictionaryValueList< uint, PartpersistentLoadedPartIds = new DictionaryValueList<uint, Part>()
 dictionaryValueList of persistentIds for all loaded Parts in the current Game More...
 
DictionaryValueList< uint,
ProtoPartSnapshot
persistentUnloadedPartIds = new DictionaryValueList<uint, ProtoPartSnapshot>()
 dictionaryValueList of persistentIds for all unloaded ProtoPartSnapShots in the current Game More...
 
DictionaryValueList< uint, VesselpersistentVesselIds = new DictionaryValueList<uint, Vessel>()
 dictionaryValueList of persistentIds for all Vessels in the current Game More...
 
float srfAttachStiffNess = 1.0f
 
float stackAttachStiffNess = 1.0f
 
List< Vesselvessels = new List<Vessel>()
 A list of all Vessels in the current Game More...
 
List< VesselvesselsLoaded = new List<Vessel>()
 A list of all Loaded Vessels in the current Game More...
 
List< VesselvesselsUnloaded = new List<Vessel>()
 A list of all Unloaded Vessels in the current Game More...
 
Vector3 vesselTargetDelta
 
Vector3 vesselTargetDirection
 
Transform vesselTargetTransform
 

Static Public Attributes

static double camera_altitude
 
static Vector3d camera_position
 
static CelestialBody currentMainBody
 
static FoRModes FoRMode = FoRModes.SRF_NORTH
 
static bool overrideOrbit = false
 
static List< physicalObjectphysicalObjects = new List<physicalObject>()
 
static bool ready
 
static double ship_dns
 nav ball rotation More...
 
static float ship_heading
 
static Quaternion ship_orientation
 
static Quaternion ship_orientation_offset
 
static double ship_temp
 
static double ship_tgtSpeed
 
static Vector3d ship_tgtVelocity
 
static float TargetSwitchSqrThresh = 60000f * 60000f
 
static bool warpDriveActive = false
 

Protected Member Functions

void PostOrbitSet (CelestialBody oldBody)
 
void PrepForOrbitSet ()
 
void UpdateInformation (bool fixedUpdate)
 

Properties

static Part activeTarget [get]
 A reference to the ship part that is actively receiving control updates (and is the camera target) More...
 
static Vessel ActiveVessel [get]
 A reference to the vessel that is actively receiving control updates (and is the camera target) More...
 
static List< CelestialBodyBodies [get]
 
static FlightGlobals fetch [get]
 
static bool PartPlacementMode [get]
 Indicates if the current active vessel is an EVA kerbal in Cargo Part Placement Mode or not. More...
 
static DictionaryValueList
< uint, Part
PersistentLoadedPartIds [get]
 Static dictionaryValueList of persistentIds for all loaded Parts in the current Game More...
 
static DictionaryValueList
< uint, ProtoPartSnapshot
PersistentUnloadedPartIds [get]
 Static dictionaryValueList of persistentIds for all unloaded ProtoPartSnapShots in the current Game More...
 
static DictionaryValueList
< uint, Vessel
PersistentVesselIds [get]
 Static dictionaryValueList of persistentIds for all Vessels in the current Game More...
 
static bool RefFrameIsRotating [get]
 
static Vector3d ship_acceleration [get]
 
static double ship_altitude [get]
 
static Vector3 ship_angularMomentum [get]
 
static Vector3d ship_angularVelocity [get]
 
static Vector3d ship_CoM [get]
 
static double ship_geeForce [get]
 
static double ship_latitude [get]
 
static double ship_longitude [get]
 
static Vector3 ship_MOI [get]
 
static double ship_obtSpeed [get]
 
static Vector3d ship_obtVelocity [get]
 
static Orbit ship_orbit [get]
 
static Vector3d ship_position [get]
 
static Quaternion ship_rotation [get]
 
static double ship_srfSpeed [get]
 
static Vector3d ship_srfVelocity [get]
 
static double ship_stP [get]
 
static Vector3d ship_upAxis [get]
 
static Vector3d ship_velocity [get]
 
static double ship_verticalSpeed [get]
 
static SpeedDisplayModes speedDisplayMode [get]
 
static float SrfAttachStiffNess [get]
 
static float StackAttachStiffNess [get]
 
static Vector3d upAxis [get]
 
static float vacuumTemperature [get]
 
static List< VesselVessels [get]
 Static reference to a list of all Vessels in the current Game More...
 
static List< VesselVesselsLoaded [get]
 Static reference to a list of all Loaded Vessels in the current Game More...
 
static List< VesselVesselsUnloaded [get]
 Static reference to a list of all Unloaded Vessels in the current Game More...
 
ITargetable VesselTarget [get]
 
VesselTargetModes vesselTargetMode [get, set]
 

Detailed Description

This class keeps all sorts of flight-related information that need to be accessed globally. Here are methods for sampling gravity, air pressure, temperature for any given flight state, as well as publicly available references to planet positions and other stuff.

Member Enumeration Documentation

Enumerator
Orbit 
Surface 
Target 

Member Function Documentation

static void FlightGlobals.addPhysicalObject ( physicalObject  pObject)
inlinestatic
static void FlightGlobals.AddVessel ( Vessel  vessel)
inlinestatic

Adds a vessel to vessel lists and persistentVesselIds list. Will also add vessel Parts or protovessel protoPartsnapshot persistentIds into relevent lists.

Parameters
vessel
static uint FlightGlobals.CheckPartpersistentId ( uint  persistentId,
Part  part,
bool  removeOldId,
bool  addNewId,
uint  vesselId = 0u 
)
inlinestatic

Check the passed in persistentId if it is zero generate a new one. If it is non zero check it does not already exist on a part. If it Does exist, generate a new one and call GameEvent onPartpersistentIdChanged If removeOldId is true will remove old entry if a new one is generated. If addNewId is true will add new entry if a new one is generated. Finally it will add the persistentId if it wasn't found.

Parameters
persistentIdpersistentId to check
partPart the persistentId belongs to or null
removeOldIdRemove the OldId if a new one is generated if this is true
addNewIdAdd the NewId if a new one is generated if this is true
vesselIdThe vessel persistent ID to use if one is available
Returns
passed in persistentId if unchanged or new one if a new one was generated
static uint FlightGlobals.CheckProtoPartSnapShotpersistentId ( uint  persistentId,
ProtoPartSnapshot  partSnapshot,
bool  removeOldId,
bool  addNewId 
)
inlinestatic

Check the passed in persistentId if it is zero generate a new one. If it is non zero check it does not already exist on a protopartsnapshot. If it Does exist, generate a new one and call GameEvent onPartpersistentIdChanged If removeOldId is true will remove old entry if a new one is generated. If addNewId is true will add new entry if a new one is generated. Finally it will add the persistentId if it wasn't found.

Parameters
persistentIdpersistentId to check
partSnapshotprotopartsnapshot the persistentId belongs to or null
removeOldIdRemove the OldId if a new one is generated if this is true

///

Parameters
addNewIdAdd the NewId if a new one is generated if this is true
Returns
passed in persistentId if unchanged or new one if a new one was generated
static uint FlightGlobals.CheckVesselpersistentId ( uint  persistentId,
Vessel  vessel,
bool  removeOldId,
bool  addNewId 
)
inlinestatic

Check the passed in persistentId if it is zero generate a new one. If it is non zero check it does not already exist on a vessel. If it Does exist, generate a new one and call GameEvent onVesselpersistentIdChanged If removeOldId is true will remove old entry if a new one is generated. If addNewId is true will add new entry if a new one is generated. Finally it will add the persistentId if it wasn't found.

Parameters
persistentId
vesselVessel the persistentId belongs to or null
removeOldIdRemove the OldId if a new one is generated if this is true
addNewIdAdd the NewId if a new one is generated if this is true
Returns
passed in persistentId if unchanged or new one if a new one was generated
static void FlightGlobals.ClearInverseRotation ( )
inlinestatic
static ClearToSaveStatus FlightGlobals.ClearToSave ( )
inlinestatic
static ClearToSaveStatus FlightGlobals.ClearToSave ( bool  logMsg)
inlinestatic
static void FlightGlobals.CycleSpeedModes ( )
inlinestatic
static bool FlightGlobals.FindLoadedPart ( uint  id,
out Part  partout 
)
inlinestatic

Find a Loaded Part from persistentId

Parameters
iduint persistentId
Returns
Part if found otherwise returns null
static Vessel FlightGlobals.FindNearestControllableVessel ( Vessel  currentVessel)
inlinestatic

Finds the nearest controllable vessel. Used for switching focus after the current vessel has died.

Parameters
currentVessel
Returns
static List<Vessel> FlightGlobals.FindNearestVesselWhere ( Vector3d  refPos,
Func< Vessel, bool >  criteria 
)
inlinestatic

Returns a filtered, distance-sorted list (from refPos) of all vessels that pass the given criteria

Parameters
criteriaA predicate to test vessels by.
Returns
A list of all vessels that fit the criteria; Empty list if none pass.
static Part FlightGlobals.FindPartByID ( uint  flightID)
inlinestatic

Finds a part on any loaded vessels with the given flight ID. Will return null if no loaded part exists with that ID (even if it does exist but is unloaded).

Parameters
flightIDThe ID of the part to find
Returns
The part if found, null if not
static ProtoPartSnapshot FlightGlobals.FindProtoPartByID ( uint  flightID)
inlinestatic

Finds a protopart on any vessels (including unloaded ones) with the given flightID.

Parameters
flightID
Returns
The protopart if found, null if none exists. Mind that the part itself might not be loaded.
static bool FlightGlobals.FindUnloadedPart ( uint  id,
out ProtoPartSnapshot  partout 
)
inlinestatic

Find an UnloadedPart from persistentId

Parameters
iduint persistentId
Returns
ProtoPartSnapshot if found otherwise returns null
static Vessel FlightGlobals.FindVessel ( Guid  id)
inlinestatic

Find Vessel in vessels list by id (Guid)

Parameters
idGuid id
Returns
Vessel or null
static bool FlightGlobals.FindVessel ( uint  id,
out Vessel  vessel 
)
inlinestatic

Find a Vessel from persistentId

Parameters
iduint persistentId
Returns
Vessel or null if not found
static bool FlightGlobals.ForceSetActiveVessel ( Vessel  v)
inlinestatic

Switch focus to another vessel, ignoring vessel-transition restrictions (use with caution). Will return false if sent to the same vessel, true on most other cases.

Parameters
v
static double FlightGlobals.getAltitudeAtPos ( Vector3d  position)
inlinestatic

returns the altitude in relation to the main body at the specified position

Parameters
positionthe position in global space
Returns
altitude in meters (units)
static float FlightGlobals.getAltitudeAtPos ( Vector3  position)
inlinestatic
static float FlightGlobals.getAltitudeAtPos ( Vector3  position,
CelestialBody  body 
)
inlinestatic
static double FlightGlobals.getAltitudeAtPos ( Vector3d  position,
CelestialBody  body 
)
inlinestatic
static double FlightGlobals.getAtmDensity ( double  pressure,
double  temperature,
CelestialBody  body = null 
)
inlinestatic

returns the atmospheric density from the given pressure level,

Parameters
pressureThe pressure in kPA
Returns
The density in kg/cm^3
static CelestialBody FlightGlobals.GetBodyByName ( string  bodyName)
inlinestatic
static int FlightGlobals.GetBodyIndex ( CelestialBody  body)
inlinestatic
static Vector3d FlightGlobals.getCentrifugalAcc ( Vector3d  pos,
CelestialBody  body 
)
inlinestatic

Returns the centrifugal acceleration for the given position and reference body. (If the planet is not in reverse-rotation, there is no centrifugal force)

< FIXME replace with appropriate dot product version

static CelestialBody FlightGlobals.GetCometPerturber ( )
inlinestatic

Which body is used in Comet Orbit and type calculations

Returns
The body reference to the Perturber
static int FlightGlobals.GetCometPerturberIndex ( )
inlinestatic

Which body is used in Comet Orbit and type calculations

Returns
The index of the Perturber
static string FlightGlobals.GetCometPerturberName ( )
inlinestatic

Name of the body used in Comet Orbit and type calculations

Returns
name key of body
static Vector3d FlightGlobals.getCoriolisAcc ( Vector3d  vel,
CelestialBody  body 
)
inlinestatic

Return the coriolis acceleration for the given velocity and reference body. (If the planet is not in reverse-rotation, there is no coriolis force)

static double FlightGlobals.GetDisplaySpeed ( )
inlinestatic
static Vector3d FlightGlobals.GetDisplayVelocity ( )
inlinestatic
static double FlightGlobals.getExternalTemperature ( )
inlinestatic

returns the outside temperature for the specified position and celestial body

Parameters
pos
Returns
static double FlightGlobals.getExternalTemperature ( double  altitude,
CelestialBody  body = null 
)
inlinestatic

returns the outside temperature for the specified position and celestial body

Parameters
pos
Returns
static double FlightGlobals.getExternalTemperature ( Vector3d  pos,
CelestialBody  body = null 
)
inlinestatic
static Quaternion FlightGlobals.GetFoR ( FoRModes  mode)
inlinestatic
static Quaternion FlightGlobals.GetFoR ( FoRModes  mode,
Transform  referenceTransform 
)
inlinestatic
static Quaternion FlightGlobals.GetFoR ( FoRModes  mode,
Transform  referenceTransform,
Orbit  orbit 
)
inlinestatic
static Vector3d FlightGlobals.getGeeForceAtPosition ( Vector3d  pos)
inlinestatic

Returns a force vector for the gravity at the specified world position. use with rigidbody.addForce() (use acceleration force mode for gravity) note: returns the force for the dominant body only (gravitational pertubations not taken into account)

Parameters
pos
Returns
static Vector3d FlightGlobals.getGeeForceAtPosition ( Vector3d  pos,
CelestialBody  mainBody 
)
inlinestatic

Returns a force vector for the gravity at the specified world position. use with rigidbody.addForce() (use acceleration force mode for gravity) note: returns the force for the dominant body only (gravitational pertubations not taken into account)

Parameters
pos
mainBodythe body
Returns

< this is the magnitude^1.5

< original code: get normal vector and multiply by gMag / sqrDistance

static CelestialBody FlightGlobals.GetHomeBody ( )
inlinestatic
static string FlightGlobals.GetHomeBodyDisplayName ( )
inlinestatic
static int FlightGlobals.GetHomeBodyIndex ( )
inlinestatic
static string FlightGlobals.GetHomeBodyName ( )
inlinestatic
static CelestialBody FlightGlobals.getMainBody ( Vector3d  refPos)
inlinestatic

Returns a reference to the celestial with the highest gravitational influence at the specified position.

Parameters
refPos
Returns
static CelestialBody FlightGlobals.getMainBody ( )
inlinestatic

Returns a reference to the celestial with the highest gravitational influence on the active ship

Returns
static string FlightGlobals.GetNotClearToSaveStatusReason ( ClearToSaveStatus  status,
string  attempt 
)
inlinestatic
static PartPointer FlightGlobals.GetPartPointerUpwardsCached ( GameObject  go)
inlinestatic

Finds and uses cached results of GetComponentUpwards<PartPointer> on the supplied game object NOTE: To reset the cache call ResetObjectPartPointerUpwardsCache

Parameters
goGame object to check for the PartPointer component.
Returns
PartPointer component attached to the game object or its parents. Null if there isn't one.
static Part FlightGlobals.GetPartUpwardsCached ( GameObject  go)
inlinestatic

Find the part component attached to the game object or its unity gameobject parents.

Finds and uses cached results of GetComponentUpwards<Part> on the supplied game object NOTE: To reset the cache call ResetObjectPartUpwardsCache

Parameters
goGame object to check for the Part component.
Returns
Part component attached to the game object or its parents. Null if there isn't one.
static double FlightGlobals.GetSqrAltitude ( Vector3d  position,
CelestialBody  body 
)
inlinestatic
static double FlightGlobals.getStaticPressure ( double  altitude,
CelestialBody  body = null 
)
inlinestatic

returns the static atmospheric pressure (in kPa) at the specified altitude and celestial body

static double FlightGlobals.getStaticPressure ( Vector3d  position)
inlinestatic

returns the static atmospheric pressure in kPa at the specified position

Parameters
position
Returns
static double FlightGlobals.getStaticPressure ( Vector3d  position,
CelestialBody  body 
)
inlinestatic
static double FlightGlobals.getStaticPressure ( )
inlinestatic

returns the static atmospheric pressure in kPa at the ship's position

Returns
static uint FlightGlobals.GetUniquepersistentId ( )
inlinestatic

Generate a Unique PersistentId uint

Returns
uint
static Vector3d FlightGlobals.getUpAxis ( )
inlinestatic
static Vector3d FlightGlobals.getUpAxis ( Vector3d  position)
inlinestatic
static Vector3d FlightGlobals.getUpAxis ( CelestialBody  body,
Vector3d  position 
)
inlinestatic
static string FlightGlobals.GGetCometPerturberDisplayName ( )
inlinestatic

Display Name of the body used in Comet Orbit and type calculations

Returns
displayName of body
void FlightGlobals.PostOrbitSet ( CelestialBody  oldBody)
inlineprotected
void FlightGlobals.PrepForOrbitSet ( )
inlineprotected
static void FlightGlobals.removePhysicalObject ( physicalObject  pObject)
inlinestatic
static void FlightGlobals.RemoveVessel ( Vessel  vessel)
inlinestatic

Removes passed in vessel from the vessel lists and persistentId dictionaries. Will also remove vessel Parts or protovessel protoPartsnapshot persistentIds into relevent lists.

Parameters
vessel
static void FlightGlobals.ResetObjectPartPointerUpwardsCache ( )
inlinestatic

Resets the cache where we remember all of the parent PartPointer references associated with different game objects. Please call this if gameobjects are ever reparented in a way that would cause its parent part to change.

static void FlightGlobals.ResetObjectPartUpwardsCache ( )
inlinestatic

Resets the cache where we remember all of the parent parts associated with different game objects. Please call this if gameobjects are ever reparented in a way that would cause its parent part to change.

Returns
static bool FlightGlobals.SetActiveVessel ( Vessel  v)
inlinestatic

Switch focus to another vessel. Returns true if successful, false if not.

Parameters
vVessel to switch to.
void FlightGlobals.SetShipOrbit ( int  selBodyIndex,
double  ecc,
double  sma,
double  inc,
double  LAN,
double  mna,
double  argPe,
double  ObT 
)
inline
void FlightGlobals.SetShipOrbitRendezvous ( Vessel  target,
Vector3d  relPosition,
Vector3d  relVelocity 
)
inline
static void FlightGlobals.SetSpeedMode ( SpeedDisplayModes  newSpeedMode)
inlinestatic
void FlightGlobals.SetVesselPosition ( int  selBodyIndex,
double  latitude,
double  longitude,
double  altitude,
double  inclination,
double  heading,
bool  asl,
bool  easeToSurface = false,
double  gravityMultiplier = 0.1 
)
inline

Sets a vessel to a Position

Parameters
selBodyIndexIndex of the body we will be setting the position above
latitudeLatitude of Position
longitudeLongitude of Position
altitudeAltitude above body surface (or "sea level" for bodies with no solid surface
inclinationInclination in degrees
headingHeading in degrees
aslAbove Surface Level
easeToSurfaceWill the vessel be using an Ease In with Gravity multiplier
gravityMultiplierGravity multiopklier for the Ease In
void FlightGlobals.SetVesselPosition ( int  selBodyIndex,
double  latitude,
double  longitude,
double  altitude,
Vector3  rotation,
bool  asl,
bool  easeToSurface = false,
double  easeInMultiplier = 0.1 
)
inline

Sets a vessel to a Position

Parameters
selBodyIndexIndex of the body we will be setting the position above
latitudeLatitude of Position
longitudeLongitude of Position
altitudeAltitude above body surface (or "sea level" for bodies with no solid surface
rotationRotation in Vector 3 form.
aslAbove Surface Level
easeToSurfaceWill the vessel be using an Ease In with Gravity multiplier
easeInMultiplierGravity multiplier value adjust the gravityMultiplier by if enabled
void FlightGlobals.SetVesselTarget ( ITargetable  tgt,
bool  overrideInputLock = false 
)
inline
static void FlightGlobals.SortVessel ( Vessel  vessel,
bool  loaded 
)
inlinestatic

Sorts a passed in vessel based on the loaded bool passed in. Moves Vessel into veselsUnloaded or vesselsLoaded dictionaries. Stores Vessel Parts persistentIds into persistentLoadedPartIds dictionary if loaded or stores Vessel protovessel protoPartSnapshots persistentIds into persistentUnloadedPartIds dictionary if not loaded

Parameters
vesselVessel
loadedbool if loaded = true or unloaded = false
void FlightGlobals.Start ( )
inline
void FlightGlobals.UpdateInformation ( bool  fixedUpdate)
inlineprotected

< orientation calculation for navballs

< heading calculation for compasses

Member Data Documentation

Vessel FlightGlobals.activeVessel
List<CelestialBody> FlightGlobals.bodies = new List<CelestialBody>()
double FlightGlobals.camera_altitude
static
Vector3d FlightGlobals.camera_position
static
CelestialBody FlightGlobals.currentMainBody
static
FoRModes FlightGlobals.FoRMode = FoRModes.SRF_NORTH
static
Camera FlightGlobals.mainCameraRef
bool FlightGlobals.overrideOrbit = false
static
DictionaryValueList<uint, Part> FlightGlobals.persistentLoadedPartIds = new DictionaryValueList<uint, Part>()

dictionaryValueList of persistentIds for all loaded Parts in the current Game

DictionaryValueList<uint, ProtoPartSnapshot> FlightGlobals.persistentUnloadedPartIds = new DictionaryValueList<uint, ProtoPartSnapshot>()

dictionaryValueList of persistentIds for all unloaded ProtoPartSnapShots in the current Game

DictionaryValueList<uint, Vessel> FlightGlobals.persistentVesselIds = new DictionaryValueList<uint, Vessel>()

dictionaryValueList of persistentIds for all Vessels in the current Game

List<physicalObject> FlightGlobals.physicalObjects = new List<physicalObject>()
static
bool FlightGlobals.ready
static
double FlightGlobals.ship_dns
static

nav ball rotation

float FlightGlobals.ship_heading
static
Quaternion FlightGlobals.ship_orientation
static
Quaternion FlightGlobals.ship_orientation_offset
static
double FlightGlobals.ship_temp
static
double FlightGlobals.ship_tgtSpeed
static
Vector3d FlightGlobals.ship_tgtVelocity
static
float FlightGlobals.srfAttachStiffNess = 1.0f
float FlightGlobals.stackAttachStiffNess = 1.0f
float FlightGlobals.TargetSwitchSqrThresh = 60000f * 60000f
static
List<Vessel> FlightGlobals.vessels = new List<Vessel>()

A list of all Vessels in the current Game

List<Vessel> FlightGlobals.vesselsLoaded = new List<Vessel>()

A list of all Loaded Vessels in the current Game

List<Vessel> FlightGlobals.vesselsUnloaded = new List<Vessel>()

A list of all Unloaded Vessels in the current Game

Vector3 FlightGlobals.vesselTargetDelta
Vector3 FlightGlobals.vesselTargetDirection
Transform FlightGlobals.vesselTargetTransform
bool FlightGlobals.warpDriveActive = false
static

Property Documentation

Part FlightGlobals.activeTarget
staticget

A reference to the ship part that is actively receiving control updates (and is the camera target)

Vessel FlightGlobals.ActiveVessel
staticget

A reference to the vessel that is actively receiving control updates (and is the camera target)

List<CelestialBody> FlightGlobals.Bodies
staticget
FlightGlobals FlightGlobals.fetch
staticget
bool FlightGlobals.PartPlacementMode
staticget

Indicates if the current active vessel is an EVA kerbal in Cargo Part Placement Mode or not.

DictionaryValueList<uint, Part> FlightGlobals.PersistentLoadedPartIds
staticget

Static dictionaryValueList of persistentIds for all loaded Parts in the current Game

DictionaryValueList<uint, ProtoPartSnapshot> FlightGlobals.PersistentUnloadedPartIds
staticget

Static dictionaryValueList of persistentIds for all unloaded ProtoPartSnapShots in the current Game

DictionaryValueList<uint, Vessel> FlightGlobals.PersistentVesselIds
staticget

Static dictionaryValueList of persistentIds for all Vessels in the current Game

bool FlightGlobals.RefFrameIsRotating
staticget
Vector3d FlightGlobals.ship_acceleration
staticget
double FlightGlobals.ship_altitude
staticget
Vector3 FlightGlobals.ship_angularMomentum
staticget
Vector3d FlightGlobals.ship_angularVelocity
staticget
Vector3d FlightGlobals.ship_CoM
staticget
double FlightGlobals.ship_geeForce
staticget
double FlightGlobals.ship_latitude
staticget
double FlightGlobals.ship_longitude
staticget
Vector3 FlightGlobals.ship_MOI
staticget
double FlightGlobals.ship_obtSpeed
staticget
Vector3d FlightGlobals.ship_obtVelocity
staticget
Orbit FlightGlobals.ship_orbit
staticget
Vector3d FlightGlobals.ship_position
staticget
Quaternion FlightGlobals.ship_rotation
staticget
double FlightGlobals.ship_srfSpeed
staticget
Vector3d FlightGlobals.ship_srfVelocity
staticget
double FlightGlobals.ship_stP
staticget
Vector3d FlightGlobals.ship_upAxis
staticget
Vector3d FlightGlobals.ship_velocity
staticget
double FlightGlobals.ship_verticalSpeed
staticget
SpeedDisplayModes FlightGlobals.speedDisplayMode
staticget
float FlightGlobals.SrfAttachStiffNess
staticget
float FlightGlobals.StackAttachStiffNess
staticget
Vector3d FlightGlobals.upAxis
staticget
float FlightGlobals.vacuumTemperature
staticget
List<Vessel> FlightGlobals.Vessels
staticget

Static reference to a list of all Vessels in the current Game

List<Vessel> FlightGlobals.VesselsLoaded
staticget

Static reference to a list of all Loaded Vessels in the current Game

List<Vessel> FlightGlobals.VesselsUnloaded
staticget

Static reference to a list of all Unloaded Vessels in the current Game

ITargetable FlightGlobals.VesselTarget
get
VesselTargetModes FlightGlobals.vesselTargetMode
getset

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