# Trajectories¶

Trajectories is a mod that displays trajectory predictions, accounting for atmospheric drag, lift, etc.. See the forum thread for more details.

This addon is not associated with and not supported by the creator of Trajectories.

The Trajectories API is accessed throgh C# reflection, and is designed for the current version. This means that future Trajectories updates may break this addon, in which case ADDONS:TR:AVAILABLE will return false. It is also possible for future versions of Trjectories to remain fully compatible.

Note

Trajectories only predicts the trajectory of the “Active Vessel,” which is the vessel with the camera focused on it. IMPACTPOS, PLANNEDVEC, SETTARGET, and CORRECTEDVEC will throw exceptions if you try to call them from an inactive vessel or if Trajectories has not calculated an impact position. You should always check if HASIMPACT is true before accessing these suffixes.

For example:

if ADDONS:TR:AVAILABLE {
} else {
PRINT "Impact position is not available".
}
} else {
PRINT "Trajectories is not available.".
}


Trajectories does its calculation based on the vessel’s current orientation. Any tiny change in orientation will change the prediction.

Accuracy is not guaranteed.

See this repository for an example of this addon being used to land a rocket on the launch pad: https://github.com/CalebJ2/kOS-landing-script

Access structure TRAddon via ADDONS:TR.

structure TRAddon
Suffix Type Description
AVAILABLE Boolean (readonly) True if a compatible Trajectories version is installed.
HASIMPACT Boolean (readonly) True if Trajectories has calculated an impact position for the current vessel.
IMPACTPOS GeoCoordinates (readonly) Returns a GeoCoordinates with the predicted impact position.
PLANNEDVEC Vector (readonly) Vector at which to point to follow predicted trajectory.
PLANNEDVECTOR Vector (readonly) Alias for PLANNEDVEC
SETTARGET(position) None Set Trajectories target.
CORRECTEDVEC Vector (readonly) Offset plus PLANNEDVEC to correct path for targeted impact.
CORRECTEDVECTOR Vector (readonly) Alias for CORRECTEDVEC
TRAddon:AVAILABLE
Type: Boolean Get

True if a compatible Trajectories version is installed.

TRAddon:HASIMPACT
Type: Boolean Get

True if Trajectories has calculated an impact position for the current Vessel. You should always check this before using impactPos, plannedVect, setTarget, or correctedVect to avoid exceptions.

TRAddon:IMPACTPOS
Type: GeoCoordinates Get

Estimated impact position.

TRAddon:PLANNEDVEC
Type: Vector Get

Vector pointing the direction your vessel should face to follow the predicted trajectory, based on the angle of attack selected in the Trajectories user interface.

TRAddon:PLANNEDVECTOR
Type: Vector Get

Alias for PLANNEDVEC

TRAddon:SETTARGET(position)
Parameters: position – GeoCoordinates None

Sets the Trajectories target landing position to the given position.

TRAddon:CORRECTEDVEC
Type: Vector Get

A vector that applies an offset to PLANNEDVEC intended to correct the predicted trajectory to impact at the selected target position. This vector does not use any aerodynamic prediction and is a very simplistic representation. Accuracy is not guaranteed, but it should at least help determine if you need to pitch the nose up or down.

TRAddon:CORRECTEDVECTOR
Type: Vector Get

Alias for CORRECTEDVEC