C# Class BetterBurnTime.ClosestApproachTracker

Inheritance: UnityEngine.MonoBehaviour
Show file Open project: KSPSnark/BetterBurnTime Class Usage Examples

Private Properties

Property Type Description
AbsolutePositionAt UnityEngine.Vector3d
Clamp double
FindClosestApproach void
Recalculate bool
Reset void
SeparationAt double
TargetVesselOf Vessel
TrackingInterval double

Public Methods

Method Description
LateUpdate ( ) : void

Called on each frame.

Start ( ) : void

Here when the add-on loads upon flight start.

Private Methods

Method Description
AbsolutePositionAt ( Orbit orbit, double time ) : UnityEngine.Vector3d

Gets the position of the orbit at the specified time, in world coordinates.

Clamp ( double value, double min, double max ) : double
FindClosestApproach ( Orbit sourceOrbit, Orbit targetOrbit, double currentTime, double &closestApproachTime, double &closestApproachDistance ) : void

Find the UT time at which body A comes closest to body B. Thanks to sarbian for the code that inspired this function: https://github.com/MuMech/MechJeb2/blob/master/MechJeb2/OrbitExtensions.cs#L123-L158

Recalculate ( ) : bool

Tries to find the vessel's closest encounter with its target, if any. Returns true if there's anything to display.

Reset ( ) : void

Reset the tracker and clear out all info.

SeparationAt ( Orbit orbit1, Orbit orbit2, double time ) : double

Gets the separation in meters of the two orbits at the specified time.

TargetVesselOf ( Vessel vessel ) : Vessel

Gets the target vessel of the specified vessel, or none if there isn't one or it's not usable for some reason.

TrackingInterval ( Orbit orbit ) : double

Get the length of time to examine for a closest approach. For elliptic orbits, this will be one orbit.

Method Details

LateUpdate() public method

Called on each frame.
public LateUpdate ( ) : void
return void

Start() public method

Here when the add-on loads upon flight start.
public Start ( ) : void
return void