.. default-domain:: js .. highlight:: js .. module:: MechJeb :no-index: 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. .. method:: 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 :rtype: ``boolean`` :Game Scenes: Flight .. method:: getDistance() The distance to the target, in meters. Throws an exception if there is no target. :Property: Read-only, cannot be set :rtype: ``number`` :Game Scenes: Flight .. method:: getDockingAxis() The world space docking axis of the target. Throws an exception if there is no target. :Property: Read-only, cannot be set :rtype: ``[number, number, number]`` :Game Scenes: Flight .. method:: getNormalTargetExists() Whether there is a target that is a vessel, a body or a direction target. :Property: Read-only, cannot be set :rtype: ``boolean`` :Game Scenes: Flight .. method:: getPosition() The world space position of the target. Throws an exception if there is no target. :Property: Read-only, cannot be set :rtype: ``[number, number, number]`` :Game Scenes: Flight .. method:: getPositionTargetExists() Whether there is a target that is a position or a vessel. :Property: Read-only, cannot be set :rtype: ``boolean`` :Game Scenes: Flight .. method:: 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 :rtype: ``[number, number, number]`` :Game Scenes: Flight .. method:: getRelativeVelocity() The world space velocity of the vessel relative to the target, in :math:`\mathrm{m/s}`. Throws an exception if there is no target. :Property: Read-only, cannot be set :rtype: ``[number, number, number]`` :Game Scenes: Flight .. method:: setDirectionTarget(name) Set the target to a direction. :param name: The name of the target. :type name: ``string`` :Game Scenes: Flight .. note:: Set the direction with :meth:`MechJeb.TargetController.updateDirectionTarget`. .. method:: 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 :rtype: :class:`SpaceCenter.Orbit` :Game Scenes: Flight .. method:: updateDirectionTarget(direction) Set the direction of the direction target. :param direction: The world space direction. :type direction: ``[number, number, number]`` :Game Scenes: Flight