Closest Approach#

class SpaceCenter.ClosestApproach#

A close approach between an orbit and a target orbit. Obtained by calling SpaceCenter.Orbit:next_closest_approach() or SpaceCenter.Orbit:closest_approaches().

Note

The object names the approach rather than describing it once: each member estimates the time of closest approach from where the two orbits are now, and describes the state at that time. The estimate moves as the game runs, so members read at different moments can differ a little; members read in one physics tick all describe the same estimate. Relative quantities are the target relative to the orbiting object (target minus self).

The search runs forward over one orbital period from the current time. Once an approach has passed and the two orbits are moving apart, the closest point in that period is the current one, so the object reports the approach as now, at the present separation, until the orbits bring another one within range.

ut: number#

The universal time of the closest approach, in seconds.

Attribute:

Read-only, cannot be set

time_to: number#

The time until the closest approach, in seconds.

Attribute:

Read-only, cannot be set

distance: number#

The distance between the objects at the closest approach, in meters.

Attribute:

Read-only, cannot be set

relative_speed: number#

The relative speed of the objects at the closest approach, in \(\mathrm{m/s}\). This is the magnitude of SpaceCenter.ClosestApproach:relative_velocity(), and does not depend on the choice of reference frame.

Attribute:

Read-only, cannot be set

vessel: SpaceCenter.Vessel | nil#

The vessel doing the approaching, or nil if it is not a vessel.

Attribute:

Read-only, cannot be set

body: SpaceCenter.CelestialBody | nil#

The celestial body doing the approaching, or nil if it is not a celestial body.

Attribute:

Read-only, cannot be set

target_vessel: SpaceCenter.Vessel | nil#

The vessel being approached, or nil if the target is not a vessel.

Attribute:

Read-only, cannot be set

target_body: SpaceCenter.CelestialBody | nil#

The celestial body being approached, or nil if the target is not a celestial body.

Attribute:

Read-only, cannot be set

position(
    reference_frame?: SpaceCenter.ReferenceFrame | Types.none
): Tuple#

The position of the orbiting object at the closest approach.

Parameters:

reference_frame – The reference frame that the returned position vector is in. Defaults to the orbital reference frame of the object the orbit belongs to.

Returns:

The position as a vector.

target_position(
    reference_frame?: SpaceCenter.ReferenceFrame | Types.none
): Tuple#

The position of the target object at the closest approach.

Parameters:

reference_frame – The reference frame that the returned position vector is in. Defaults to the orbital reference frame of the object the orbit belongs to.

Returns:

The position as a vector.

velocity(
    reference_frame?: SpaceCenter.ReferenceFrame | Types.none
): Tuple#

The velocity of the orbiting object at the closest approach.

Parameters:

reference_frame – The reference frame that the returned velocity vector is in. Defaults to the orbital reference frame of the object the orbit belongs to.

Returns:

The velocity as a vector.

target_velocity(
    reference_frame?: SpaceCenter.ReferenceFrame | Types.none
): Tuple#

The velocity of the target object at the closest approach.

Parameters:

reference_frame – The reference frame that the returned velocity vector is in. Defaults to the orbital reference frame of the object the orbit belongs to.

Returns:

The velocity as a vector.

relative_position(
    reference_frame?: SpaceCenter.ReferenceFrame | Types.none
): Tuple#

The position of the target relative to the orbiting object at the closest approach.

Parameters:

reference_frame – The reference frame whose axes the returned vector is expressed in. Defaults to the orbital reference frame of the object the orbit belongs to.

Returns:

The relative position as a vector.

relative_velocity(
    reference_frame?: SpaceCenter.ReferenceFrame | Types.none
): Tuple#

The velocity of the target relative to the orbiting object at the closest approach.

Parameters:

reference_frame – The reference frame whose axes the returned vector is expressed in. Defaults to the orbital reference frame of the object the orbit belongs to.

Returns:

The relative velocity as a vector.