Difference between revisions of "API:Vessel"

From Kerbal Space Program Wiki
Jump to: navigation, search
(Situations should be Vessel.Situations enum)
(fix up 'implements' list for template change)
Line 3: Line 3:
 
<!-- Autogenerated by DOCTOOL.  Yell at N3X15 if it breaks. -->
 
<!-- Autogenerated by DOCTOOL.  Yell at N3X15 if it breaks. -->
 
{{Class
 
{{Class
|inherits=<ul><li>{{Type|MonoBehaviour}}</li><li>{{Type|IShipconstruct}}</li><li>{{Type|ITargetable}}</li></ul>
+
|inherits={{Type|MonoBehaviour}}
 +
|implements=<ul><li>{{Type|IDiscoverable}}</li><li>{{Type|IShipconstruct}}</li><li>{{Type|ITargetable}}</li></ul>
 
|name=Vessel
 
|name=Vessel
 
|summary=Vessels define individual ships in flight. They work essentially as a header for the set of parts that make up the ship.
 
|summary=Vessels define individual ships in flight. They work essentially as a header for the set of parts that make up the ship.

Revision as of 03:04, 13 June 2014

A Vessel represents a ship, or a piece of debris that was once part of a ship. You can access the vessel that your Part is part of with this.vessel. Particularly useful members are vessel.orbit, which gives your orbit, and vessel.mainBody, which gives CelestialBody whose influence you are currently under.

Vessel Class

Inherits Implements
MonoBehaviour
  • IDiscoverable
  • IShipconstruct
  • ITargetable

Vessels define individual ships in flight. They work essentially as a header for the set of parts that make up the ship.

Properties

The following are public properties available in Vessel.

Signature Description
string landedAt { }
Part this { get; }
enum Situations { }
bool isCommandable { }
bool packed { }
bool LandedOrSplashed { get; set; }
ActionGroupList ActionGroups { }
Transform ReferenceTransform { get; } The reference transform is used to define the orientation of a vessel for controls and gauges. It defines which way is 'up' or 'forward' or which way pitch rotates, for instance. Read only. Use SetReferenceTransform to set. Defaults to vessel transform if no other transform is set.
double launchTime { }
bool HoldPhysics { }
PatchedConicSolver patchedConicSolver { get; }
Vessel.Situations situation { }

Fields

The following is a list of publically-accessible fields in Vessel. This includes protected items, which can be accessed by subclasses.

Signature Description
double verticalSpeed The vertical speed of the vessel, relative to the surface of the reference body.
Vector3 rb_velocity The current velocity of the Unity physics rigidbody.
Quaternion srfRelRotation The Quaternion corresponding to the vessel's rotation, relative to the surface of reference body.
double staticPressure The current static pressure of the vessel, presumably in newtons per meter squared.
Vector3d acceleration The current acceleration vector of the vessel.
double geeForce The current magnitude of gravity, in meters per second squared.
int currentStage Current stage of the vessel.
ProtoVessel protoVessel
Vector3d obt_velocity The orbital velocity vector of the vessel, relative to the reference body.
Vector3d upAxis Vector corresponding to the vessel's up facing direction.
string vesselName Name identifier of the vessel.
double specificAcceleration Specific acceleration is the vessel's potential acceleration per unit of throttle. Used to estimate burn times and such. NOTE: this value is calculated based on smoothed acceleration, so it isn't completely accurate. It will also change as the vessel's mass is reduced as fuel burns away. (it does get pretty accurate after burning for a few seconds)
float heightFromTerrain The vessel's altitude above the reference body's terrain, not including liquid bodies.
OrbitDriver orbitDriver
FlightIntegrator flightIntegrator
FlightCtrlState ctrlState The vessel's flight control state object, used for accessing and modifying user and fly-by-wire input.
Vector3 terrainNormal The vector perpendicular to the terrain.
static float
double pqsAltitude
double terrainAltitude The height of the terrain, relative to the center of the reference body.
Vector3 angularVelocity The angular velocity vector of the vessel.
PatchedConicRenderer patchedConicRenderer
CelestialBody mainBody The reference body of the vessel.
bool isPersistent
OrbitTargeter orbitTargeter
float heightFromSurface The height above the surface of the reference body, including liquid bodies.
bool Landed True if the vessel has landed.
bool isEVA True if the vessel is an EVA kerbal.
bool HasActiveCrew True if the vessel has at least one crewmember and is active (focused).
Vector3d perturbation
double missionTime
Vector3 CoM The vector corresponding to the vessel's center of mass, relative to the vessel origin.
double longitude
Part rootPart The root part of the vessel.
Orbit orbit
bool loaded True if the vessel has loaded.
uint referenceTransformId
double latitude
bool isActiveVessel True if the vessel is the active vessel.
double altitude Height above the surface of the reference body, including liquid bodies.
State state
enum State
Vector3 localCoM This is used for persistence purposes. Use findLocalCenterOfMass() if you just want the center of mass.
Guid id Unique identifier for each vessel.

Methods

The following are methods included in Vessel.

Signature Description
static string GetMETString()
static string GetSituationString()
Vector3 findWorldCenterOfMass() Finds the world center of mass recursively from the given ship part.
bool checkSplashed()
void GoOffRails() puts the ship back into a simulated orbit and reenables physics
OrbitDriver GetOrbitDriver()
Vector3 GetObtVelocity()
void FallBackReferenceTransform()
void ClearStaging()
void DestroyVesselComponents()
void ResetCollisionIgnores()
Transform GetTransform()
void ChangeWorldVelocity() change the worldspace velocity of this vessel
float GetHeightFromTerrain()
string GetName()
void SpawnCrew()
float GetHeightFromSurface()
ProtoVessel BackupVessel()
void FeedInputFeed()
Vector3 GetSrfVelocity()
void ResumeStaging()
Orbit GetOrbit()
void SetPosition()
void printGroundContacts()
void SetWorldVelocity() set the absolute world velocity of this vessel
void SetRotation() Sets the worldspace rotation of this vessel, and all its parts
void DespawnCrew()
List<ProtoCrewMember> GetVesselCrew() Returns a list of ProtoCrewMembers corresponding to each kerbal on board. ProtoCrewMember contains many fields relating to the kerbals stats such as name, courage, etc.
Vector3 findLocalCenterOfMass() Finds the local center of mass recursively from the given ship part.
void OnLoadFlightState()
int GetCrewCount()
void OnDestroy()
void OnSaveFlightState()
ClearToSaveStatus IsClearToSave()
Vector3 GetFwdVector()
void Translate()
Vector3d GetWorldPos3D() Get a double precision vector for the vessel's worldspace position (for when transform.position isn't accurate enough)
Vector3 findLocalCenterOfPressure()
void Unload()
void StartFromBackup() Start from backup is used when the scene is being resumed, and the Vessel component is added before the parts themselves. Note that this method won't load the parts. It only creates the vessel object. To load parts, use the Vessel.Load() method.
bool checkVisibility() Returns true if this vessel is within the visible range of any commandable (focusable) vessel, false otherwise.
int GetCrewCapacity()
float GetTotalMass() Get the sum of the mass of all (physical) parts on this vessel
Vessel GetVessel()
void Die()
Vector3 findLocalMOI()
void GoOnRails() disables physics and puts the ship into a propagated orbit
bool checkLanded()
void MakeInactive()
void SetReferenceTransform()
void printCollisions()
void MakeActive()
void Initialize() Initialize is used in cases where the Vessel component is added to a ship that already exists.
void SetPosition(Vector3 position) Sets the worldspace position of this vessel, and all its parts
void Load()