TargetController#

class MechJeb.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.

TargetController.getCanAlign()#

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

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

TargetController.getDistance()#

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

Property:

Read-only, cannot be set

Return type:

number

Game Scenes:

Flight

TargetController.getDockingAxis()#

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

Property:

Read-only, cannot be set

Return type:

[number, number, number]

Game Scenes:

Flight

TargetController.getNormalTargetExists()#

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

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

TargetController.getPosition()#

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

Property:

Read-only, cannot be set

Return type:

[number, number, number]

Game Scenes:

Flight

TargetController.getPositionTargetExists()#

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

Property:

Read-only, cannot be set

Return type:

boolean

Game Scenes:

Flight

TargetController.getRelativePosition()#

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

Property:

Read-only, cannot be set

Return type:

[number, number, number]

Game Scenes:

Flight

TargetController.getRelativeVelocity()#

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

Property:

Read-only, cannot be set

Return type:

[number, number, number]

Game Scenes:

Flight

TargetController.setDirectionTarget(name)#

Set the target to a direction.

Arguments:
  • name (string) – The name of the target.

Game Scenes:

Flight

TargetController.getTargetOrbit()#

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

Property:

Read-only, cannot be set

Return type:

SpaceCenter.Orbit

Game Scenes:

Flight

TargetController.updateDirectionTarget(direction)#

Set the direction of the direction target.

Arguments:
  • direction ([number, number, number]) – The world space direction.

Game Scenes:

Flight