Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Types | Public Member Functions | Public Attributes | Properties | List of all members
OrbitDriver Class Reference
Inheritance diagram for OrbitDriver:

Public Types

enum  UpdateMode { UpdateMode.TRACK_Phys, UpdateMode.UPDATE, UpdateMode.IDLE }
 

Public Member Functions

delegate void CelestialBodyDelegate (CelestialBody body)
 
bool CheckDominantBody (Vector3d refPos)
 
void OnRailsSOITransition (Orbit ownOrbit, CelestialBody to)
 
void RecalculateOrbit (CelestialBody newReferenceBody)
 
void SetOrbitMode (UpdateMode mode)
 
void TrackRigidbody (CelestialBody refBody, double fdtOffset)
 This method updates keplerian parameters from given vessel's position and velocity in worldspace with respect to the reference body. It can also be passed a refbody which is not the current referenceBody; this is for calculating new keplerian parameters when changing frames of reference. NOTE: This normally runs before PhysX integration, which means before our current velocity is applied to our position. However, when on rails, we are pushing a new position and velocity and so when OrbitDriver is running they are correct for the given UT. VesselPrecalculate will also at times run this after PhysX integration runs (i.e. it will run this on its Update, and then not run it on the following fixed frame). So we need to decide: Are we computing our orbit pre-integration or post? If we are computing pre-integration, we need to use the last frame's timestamp when passing our position and velocity in. More...
 
void updateFromParameters ()
 
void UpdateOrbit (bool offset=true)
 

Public Attributes

CelestialBody celestialBody
 
bool drawOrbit
 
Transform driverTransform
 
bool frameShift
 
UpdateMode lastMode = UpdateMode.TRACK_Phys
 
double lastTrackUT
 
float lowerCamVsSmaRatio = 0.03f
 
CelestialBodyDelegate OnReferenceBodyChange
 
Orbit orbit = new Orbit()
 
Color orbitColor = Color.grey
 
Vector3d pos
 
bool QueuedUpdate
 
OrbitRendererBase Renderer
 
bool reverse
 
UpdateMode updateMode
 
float upperCamVsSmaRatio = 25f
 
Vessel vessel
 

Properties

bool Ready [get]
 True when the OrbitDriver has been started and initialized. More...
 
CelestialBody referenceBody [get, set]
 
ITargetable Targetable [get]
 

Member Enumeration Documentation

Enumerator
TRACK_Phys 
UPDATE 
IDLE 

Member Function Documentation

delegate void OrbitDriver.CelestialBodyDelegate ( CelestialBody  body)
bool OrbitDriver.CheckDominantBody ( Vector3d  refPos)
inline
void OrbitDriver.OnRailsSOITransition ( Orbit  ownOrbit,
CelestialBody  to 
)
inline

< initial guess

< find the exact moment of SOI transition (must have happened sometime between the last frame and now)

void OrbitDriver.RecalculateOrbit ( CelestialBody  newReferenceBody)
inline

< Unlike scenarios (progress, contracts, etc), modules won't respond if unloaded. ModuleTripLogger needs to recognize this event.

void OrbitDriver.SetOrbitMode ( UpdateMode  mode)
inline
void OrbitDriver.TrackRigidbody ( CelestialBody  refBody,
double  fdtOffset 
)
inline

This method updates keplerian parameters from given vessel's position and velocity in worldspace with respect to the reference body. It can also be passed a refbody which is not the current referenceBody; this is for calculating new keplerian parameters when changing frames of reference. NOTE: This normally runs before PhysX integration, which means before our current velocity is applied to our position. However, when on rails, we are pushing a new position and velocity and so when OrbitDriver is running they are correct for the given UT. VesselPrecalculate will also at times run this after PhysX integration runs (i.e. it will run this on its Update, and then not run it on the following fixed frame). So we need to decide: Are we computing our orbit pre-integration or post? If we are computing pre-integration, we need to use the last frame's timestamp when passing our position and velocity in.

Parameters
refBodythe ref body to compute against (may not be current referenceBody)
fdtOffsetthe offset to the current UT to apply when computing the orbit. Per above this may be (last frame UT - this frame UT) since the pos and vel are from the last frame's UT during integration

< convert the rigidbody vectors into the proper coordinate space (Z-up, centered at reference body)

< orbital pos wrt old reference body

< our pos and vel in this case are not set until

< convert from rot to inertial

void OrbitDriver.updateFromParameters ( )
inline
void OrbitDriver.UpdateOrbit ( bool  offset = true)
inline

Member Data Documentation

CelestialBody OrbitDriver.celestialBody
bool OrbitDriver.drawOrbit
Transform OrbitDriver.driverTransform
bool OrbitDriver.frameShift
UpdateMode OrbitDriver.lastMode = UpdateMode.TRACK_Phys
double OrbitDriver.lastTrackUT
float OrbitDriver.lowerCamVsSmaRatio = 0.03f
CelestialBodyDelegate OrbitDriver.OnReferenceBodyChange
Orbit OrbitDriver.orbit = new Orbit()
Color OrbitDriver.orbitColor = Color.grey
Vector3d OrbitDriver.pos
bool OrbitDriver.QueuedUpdate
OrbitRendererBase OrbitDriver.Renderer
bool OrbitDriver.reverse
UpdateMode OrbitDriver.updateMode
float OrbitDriver.upperCamVsSmaRatio = 25f
Vessel OrbitDriver.vessel

Property Documentation

bool OrbitDriver.Ready
get

True when the OrbitDriver has been started and initialized.

CelestialBody OrbitDriver.referenceBody
getset
ITargetable OrbitDriver.Targetable
get

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