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.

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.

Attribute:

Read-only, cannot be set

Return type:

bool

Game Scenes:

Flight

distance#

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

Attribute:

Read-only, cannot be set

Return type:

float

Game Scenes:

Flight

docking_axis#

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

Attribute:

Read-only, cannot be set

Return type:

tuple(float, float, float)

Game Scenes:

Flight

normal_target_exists#

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

Attribute:

Read-only, cannot be set

Return type:

bool

Game Scenes:

Flight

position#

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

Attribute:

Read-only, cannot be set

Return type:

tuple(float, float, float)

Game Scenes:

Flight

position_target_exists#

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

Attribute:

Read-only, cannot be set

Return type:

bool

Game Scenes:

Flight

relative_position#

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

Attribute:

Read-only, cannot be set

Return type:

tuple(float, float, float)

Game Scenes:

Flight

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.

Attribute:

Read-only, cannot be set

Return type:

tuple(float, float, float)

Game Scenes:

Flight

set_direction_target(name)#

Set the target to a direction.

Parameters:

name (str) – The name of the target.

Game Scenes:

Flight

Note

Set the direction with TargetController.update_direction_target().

target_orbit#

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

Attribute:

Read-only, cannot be set

Return type:

SpaceCenter.Orbit

Game Scenes:

Flight

update_direction_target(direction)#

Set the direction of the direction target.

Parameters:

direction (tuple) – The world space direction.

Game Scenes:

Flight