TargetController#

class TargetController#

The target controller, which holds MechJeb’s target.

Note

Positions and directions are in world space, the coordinate system of the game’s physics.

bool can_align()#

Whether the vessel can align with the target, which it can with a docking port. Throws an exception if there is no target.

Game Scenes:

Flight

float distance()#

The distance to the target, in meters. Throws an exception if there is no target.

Game Scenes:

Flight

std::tuple<double, double, double> docking_axis()#

The world space docking axis of the target. Throws an exception if there is no target.

Game Scenes:

Flight

bool normal_target_exists()#

Whether there is a target that is a vessel, a body or a direction target.

Game Scenes:

Flight

std::tuple<double, double, double> position()#

The world space position of the target. Throws an exception if there is no target.

Game Scenes:

Flight

bool position_target_exists()#

Whether there is a target that is a position or a vessel.

Game Scenes:

Flight

std::tuple<double, double, double> relative_position()#

The world space position of the vessel relative to the target. Throws an exception if there is no target.

Game Scenes:

Flight

std::tuple<double, double, double> relative_velocity()#

The world space velocity of the vessel relative to the target, in \(\mathrm{m/s}\). Throws an exception if there is no target.

Game Scenes:

Flight

void set_direction_target(std::string name)#

Set the target to a direction.

Parameters:
  • name – The name of the target.

Game Scenes:

Flight

Note

Set the direction with TargetController::update_direction_target().

SpaceCenter::Orbit target_orbit()#

The orbit of the target. Throws an exception if there is no target, or the target has no orbit.

Game Scenes:

Flight

void update_direction_target(std::tuple<double, double, double> direction)#

Set the direction of the direction target.

Parameters:
  • direction – The world space direction.

Game Scenes:

Flight