Vehicle#

public class Vehicle#

A vehicle in the current system. Obtained from getActiveVehicle() or getVehicles().

Note

Docking and undocking replace the vehicles involved, so an object for one of them throws an exception afterwards.

String getName()#
void setName(String value)#

The name of the vehicle, which is unique in the system.

void destroy()#

Destroy the vehicle, killing its crew, as abandoning the vehicle does. Returns once the vehicle is gone.

Note

If the vehicle is the active vehicle, the game hands control to a nearby vehicle.

boolean getCanRecover()#

Whether the vehicle can be recovered: at rest on the surface of the home planet.

void recover()#

Recover the vehicle, ending its crew’s missions, as the game’s recover button does. Returns once the vehicle is gone.

Note

Throws an exception if the vehicle cannot be recovered, see Vehicle.getCanRecover().

Situation getSituation()#

The situation of the vehicle.

boolean getOnRails()#

Whether the game moves the vehicle without simulating the forces on it: along its orbit, or held on the surface. True in the freefall, landed, floating and bottomed situations.

boolean getIsDebris()#

Whether the vehicle is debris, such as a spent stage.

boolean getHasLaunched()#

Whether the vehicle has launched.

double getLaunchTime()#

The universal time the vehicle was created, in seconds.

float getMass()#

The total mass of the vehicle, including propellant, in kilograms.

float getPropellantMass()#

The mass of the propellant in the vehicle, in kilograms.

float getThrust()#

The thrust of the engines at their current throttle and the current atmospheric pressure, in Newtons.

float getAvailableThrust()#

The thrust of the active engines that have propellant, at full throttle and the current atmospheric pressure, in Newtons.

float getSpecificImpulse()#

The combined specific impulse of the active engines that have propellant, at the current atmospheric pressure, in seconds. Zero when no engine is active.

float getPeakGLoad()#

The highest smoothed g-load on the vehicle during the last physics step, as a multiple of standard gravity. Zero while the vehicle is Vehicle.getOnRails().

float getMaxGLoad()#

The g-load the vehicle can take before it breaks up, as a multiple of standard gravity. Zero while the vehicle is Vehicle.getOnRails().

float getPeakDynamicPressure()#

The highest dynamic pressure on the vehicle during the last physics step, in pascals. In the sea, this is the dynamic pressure of the water. Zero while the vehicle is Vehicle.getOnRails().

float getMaxDynamicPressure()#

The dynamic pressure the vehicle can take before it breaks up, in pascals. Zero while the vehicle is Vehicle.getOnRails().

java.util.List<Part> getParts()#

The vehicle’s parts.

Part getRootPart()#

The vehicle’s root part, which the other parts are attached to.

java.util.List<Part> partsWithName(String name)#

The vehicle’s parts with the given template id. See Part.getName().

Parameters:
  • name (String) – The template id.

java.util.List<Seat> getSeats()#

The vehicle’s crew seats.

java.util.List<Kitten> getCrew()#

The kittens in the vehicle’s seats.

int getCrewCapacity()#

The number of crew seats in the vehicle.

java.util.List<Engine> getEngines()#

The vehicle’s engines.

java.util.List<RCS> getRCS()#

The vehicle’s RCS thrusters.

java.util.List<Decoupler> getDecouplers()#

The vehicle’s decouplers.

java.util.List<Parachute> getParachutes()#

The vehicle’s parachutes.

java.util.List<Tank> getTanks()#

The vehicle’s propellant tanks.

java.util.List<Battery> getBatteries()#

The vehicle’s batteries.

java.util.List<SolarPanel> getSolarPanels()#

The vehicle’s solar panels.

java.util.List<Generator> getGenerators()#

The vehicle’s generators.

java.util.List<PowerConsumer> getPowerConsumers()#

The vehicle’s power consumers.

float getStoredEnergy()#

The energy stored in the vehicle’s batteries, in joules.

float getEnergyCapacity()#

The energy the vehicle’s batteries can store, in joules.

float getNetPower()#

The power produced by the vehicle’s solar panels and generators, less the power its parts use, in watts.

java.util.List<Light> getLights()#

The vehicle’s lights.

java.util.List<Deployable> getDeployables()#

The vehicle’s deployable sections.

java.util.List<MagneticScoop> getMagneticScoops()#

The vehicle’s magnetic scoops.

java.util.List<FuelLink> getFuelLinks()#

The vehicle’s fuel links.

java.util.List<DockingPort> getDockingPorts()#

The vehicle’s docking ports.

java.util.List<Resource> getResources()#

The resources the vehicle holds, one for each substance, totaled over its parts.

float getDeltaV()#

The change in velocity of all the vehicle’s sequences, in meters per second.

java.util.List<Sequence> getSequences()#

The vehicle’s sequences, in activation order.

Vehicle getTargetVehicle()#
void setTargetVehicle(Vehicle value)#

The vehicle targeted by this vehicle, or null. Setting it replaces the target, and null clears it.

Body getTargetBody()#
void setTargetBody(Body value)#

The body targeted by this vehicle, or null. Setting it replaces the target, and null clears it.

Note

Setting a body that orbits nothing, such as the star, throws an exception.

Part getTargetPart()#
void setTargetPart(Part value)#

The part targeted by this vehicle, on the vehicle in Vehicle.getTargetVehicle(), or null. Setting it targets the part and its vehicle, and null clears the target.

java.util.List<Burn> getBurns()#

The vehicle’s planned burns, in time order.

Burn addBurn(double ut, float prograde, float normal, float radial)#

Plan a burn, and add it to the vehicle’s burn plan.

Parameters:
  • ut (double) – Universal time of the burn, in seconds.

  • prograde (float) – Change in velocity in the prograde direction, in meters per second.

  • normal (float) – Change in velocity along the orbit normal, in meters per second.

  • radial (float) – Change in velocity radially outward, in meters per second.

Returns:

The burn.

Note

Returns once the flight computer has timed the burn, if it is the next one. Throws an exception if the time is in the past, or beyond the vehicle’s predicted trajectory.

Orbit getOrbit()#

The current orbit of the vehicle.

Flight getFlight()#

Flight telemetry for the vehicle, relative to the surface of the body it orbits.

Game Scenes:

Flight

Control getControl()#

The controls of the vehicle.

Game Scenes:

Flight

AutoPilot getAutoPilot()#

The auto-pilot of the vehicle.

Game Scenes:

Flight

ReferenceFrame getReferenceFrame()#

The reference frame fixed to the vehicle, with its origin at the vehicle’s position. The x axis points forward, the y axis to the right and the z axis down, relative to the vehicle’s control point.

ReferenceFrame getSurfaceReferenceFrame()#

The reference frame with its origin at the vehicle’s position, and axes aligned with the surface below it. The x axis points east, the y axis north and the z axis up. The frame rotates with the body.

ReferenceFrame getOrbitalReferenceFrame()#

The reference frame with its origin at the vehicle’s position, and axes aligned with its orbit. The x axis points prograde, the y axis along the orbit normal and the z axis radially outward, perpendicular to the x axis.

org.javatuples.Triplet<Double, Double, Double> position(ReferenceFrame referenceFrame)#

The position of the vehicle, in meters.

Parameters:
  • referenceFrame (ReferenceFrame) – The reference frame of the position.

org.javatuples.Triplet<Double, Double, Double> velocity(ReferenceFrame referenceFrame)#

The velocity of the vehicle, in meters per second.

Parameters:
  • referenceFrame (ReferenceFrame) – The reference frame of the velocity.

org.javatuples.Triplet<Double, Double, Double> direction(ReferenceFrame referenceFrame)#

The unit vector in which the vehicle points, the x axis of Vehicle.getReferenceFrame().

Parameters:
  • referenceFrame (ReferenceFrame) – The reference frame of the direction.

org.javatuples.Quartet<Double, Double, Double, Double> rotation(ReferenceFrame referenceFrame)#

The rotation of Vehicle.getReferenceFrame() relative to the given frame.

Parameters:
  • referenceFrame (ReferenceFrame) – The reference frame of the rotation.

org.javatuples.Triplet<Double, Double, Double> angularVelocity(ReferenceFrame referenceFrame)#

The angular velocity of the vehicle, in radians per second. The vector points along the axis of rotation, and its length is the rate of rotation.

Parameters:
  • referenceFrame (ReferenceFrame) – The reference frame of the angular velocity.

public enum Situation#

The situation of a vehicle: its contact with the surface, and whether the game is simulating it with physics or propagating it along its orbit. See Vehicle.getSituation().

public Situation MANEUVERING#

No surface contact, simulated with physics.

public Situation FREEFALL#

No surface contact, on rails.

public Situation ROLLING#

On terrain, simulated with physics.

public Situation LANDED#

At rest on terrain.

public Situation SAILING#

In the ocean, simulated with physics.

public Situation FLOATING#

At rest in the ocean.

public Situation DRAGGING#

On terrain and in the ocean, simulated with physics.

public Situation BOTTOMED#

At rest on terrain and in the ocean.

public class VehicleDesign#

A vehicle design that can be launched: one of the game’s default vehicles, or a vehicle saved by the player in the editor. Obtained from getVehicleDesigns().

Note

The mass and delta-v are those the editor shows for the design.

String getName()#

The name of the design, as passed to launchVehicle(String, String).

boolean getIsDefault()#

Whether the design is one of the game’s default vehicles.

int getPartCount()#

The number of parts in the design.

float getMass()#

The total mass of the design, including propellant, in kilograms.

float getDryMass()#

The mass of the design without propellant, in kilograms.

float getDeltaV()#

The change in velocity of all the design’s sequences, in meters per second.

Note

Each sequence is computed in the environment chosen for it in the editor, in vacuum or at sea level.