#[repr(C)]pub struct VesselContext { /* private fields */ }
Expand description
Rust interface to the VESSELx
abstract classes in Orbiter SDK
Implementations§
Source§impl VesselContext
impl VesselContext
Source§impl VesselContext
impl VesselContext
Sourcepub fn Global2Local(&self, global: &VECTOR3, local: &mut VECTOR3)
pub fn Global2Local(&self, global: &VECTOR3, local: &mut VECTOR3)
Performs a transformation from global (ecliptic) to local vessel coordinates
Source§impl VesselContext
impl VesselContext
Sourcepub fn Local2Global(&self, local: &VECTOR3, global: &mut VECTOR3)
pub fn Local2Global(&self, local: &VECTOR3, global: &mut VECTOR3)
Performs a transformation from local vessel to global (ecliptic) coordinates
Source§impl VesselContext
impl VesselContext
Sourcepub fn SetSize(&self, size: f64)
pub fn SetSize(&self, size: f64)
Set the vessel’s mean radius
The size should correspond to the vessel’s visual representation, for example the mesh used to show the vessel in the simulation window. The size parameter is used by Orbiter to determine the camera distance at which the vessel is within visual range of the observer camera. It is also used for calculating various physical parameters. If SetSize is not called during the vessel setup, the value from the Size entry in the vessel’s configuration file is used.
Source§impl VesselContext
impl VesselContext
Source§impl VesselContext
impl VesselContext
Sourcepub fn SetEmptyMass(&self, empty_mass: f64)
pub fn SetEmptyMass(&self, empty_mass: f64)
Set the vessel’s empty mass (excluding propellants)
Source§impl VesselContext
impl VesselContext
Sourcepub fn SetCameraOffset(&self, camera_offset: &VECTOR3)
pub fn SetCameraOffset(&self, camera_offset: &VECTOR3)
Set the camera position for internal (cockpit) view.
§Arguments
camera_offset
- Camera offset in vessel coordinates
Source§impl VesselContext
impl VesselContext
Sourcepub fn SetTouchdownPoints(&self, pt1: &VECTOR3, pt2: &VECTOR3, pt3: &VECTOR3)
pub fn SetTouchdownPoints(&self, pt1: &VECTOR3, pt2: &VECTOR3, pt3: &VECTOR3)
Defines the three points defining the vessel’s ground contact plane
Source§impl VesselContext
impl VesselContext
Sourcepub fn SetThrusterDir(&self, th: THRUSTER_HANDLE, dir: &VECTOR3)
pub fn SetThrusterDir(&self, th: THRUSTER_HANDLE, dir: &VECTOR3)
Reset the force direction of a thruster
Source§impl VesselContext
impl VesselContext
Sourcepub fn SetThrusterLevel(&self, th: THRUSTER_HANDLE, level: f64)
pub fn SetThrusterLevel(&self, th: THRUSTER_HANDLE, level: f64)
Set thrust level for a thruster
Source§impl VesselContext
impl VesselContext
Sourcepub fn SetThrusterLevel_SingleStep(&self, th: THRUSTER_HANDLE, level: f64)
pub fn SetThrusterLevel_SingleStep(&self, th: THRUSTER_HANDLE, level: f64)
Set the thrust level of a thruster for the current time step only
Source§impl VesselContext
impl VesselContext
Source§impl VesselContext
impl VesselContext
Sourcepub fn AddMeshWithOffset(&self, mesh_name: String, ofs: &VECTOR3)
pub fn AddMeshWithOffset(&self, mesh_name: String, ofs: &VECTOR3)
Load a mesh definition for the vessel from a file displaced by offset ofs
§Arguments
mesh_name
- name of the mesh file (without extension)ofs
- a displacement vector which describes the offset of the mesh origin against the vessel origin
Source§impl VesselContext
impl VesselContext
Sourcepub fn AddExhaust(&self, th: THRUSTER_HANDLE, lscale: f64, wscale: f64) -> usize
pub fn AddExhaust(&self, th: THRUSTER_HANDLE, lscale: f64, wscale: f64) -> usize
Add an exhaust render definition for a thruster
Source§impl VesselContext
impl VesselContext
Sourcepub fn CreatePropellantResource(&self, mass: f64) -> PROPELLANT_HANDLE
pub fn CreatePropellantResource(&self, mass: f64) -> PROPELLANT_HANDLE
Create a new propellant resource (“fuel tank”)
Propellant resources are a component of the vessel’s propulsion system. They can hold propellants and distribute them to connected engines to generate thrust
Source§impl VesselContext
impl VesselContext
Sourcepub fn CreateThruster(
&self,
pos: &VECTOR3,
dir: &VECTOR3,
maxth0: f64,
ph: PROPELLANT_HANDLE,
isp: f64,
) -> THRUSTER_HANDLE
pub fn CreateThruster( &self, pos: &VECTOR3, dir: &VECTOR3, maxth0: f64, ph: PROPELLANT_HANDLE, isp: f64, ) -> THRUSTER_HANDLE
Add a logical thruster definition for the vessel
Source§impl VesselContext
impl VesselContext
Sourcepub fn CreateThrusterGroup(
&self,
thrusters: &[THRUSTER_HANDLE],
thgroup_type: THGROUP_TYPE,
) -> THGROUP_HANDLE
pub fn CreateThrusterGroup( &self, thrusters: &[THRUSTER_HANDLE], thgroup_type: THGROUP_TYPE, ) -> THGROUP_HANDLE
Combine thrusters into a logical thruster group
Source§impl VesselContext
impl VesselContext
Sourcepub fn ClearMeshes(&self)
pub fn ClearMeshes(&self)
Remove all mesh definitions for the vessel
Source§impl VesselContext
impl VesselContext
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetPropellantMass(&self, ph: PROPELLANT_HANDLE) -> f64
pub fn GetPropellantMass(&self, ph: PROPELLANT_HANDLE) -> f64
Returns the current mass of a propellant resource specified by ph
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetAngularVel(&self, a_vel: &mut VECTOR3)
pub fn GetAngularVel(&self, a_vel: &mut VECTOR3)
Get angular velocity (in rad/s) of the spacecraft around its principal axes and store it in a_vel
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetAirspeedVector(
&self,
ref_frame: REFFRAME,
airspeed: &mut VECTOR3,
) -> bool
pub fn GetAirspeedVector( &self, ref_frame: REFFRAME, airspeed: &mut VECTOR3, ) -> bool
Returns the vessel’s true “airspeed” vector
This method returns the true airspeed vector in the requested frame of reference. The ground airvector is defined as the vessel’s velocity vector with respect to the surrounding freestream air flow. If the vessel is not within an a planetary atmosphere, the returned vector is equal to the groundspeed vector
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetThrustVector(&self, thrust_vec: &mut VECTOR3) -> bool
pub fn GetThrustVector(&self, thrust_vec: &mut VECTOR3) -> bool
Returns thrust force vector in local vessel coordinates
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetTotalPropellantMass(&self) -> f64
pub fn GetTotalPropellantMass(&self) -> f64
Returns the vessel’s current total propellant mass
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetThrusterGroupLevelByType(&self, thgroup_type: THGROUP_TYPE) -> f64
pub fn GetThrusterGroupLevelByType(&self, thgroup_type: THGROUP_TYPE) -> f64
Returns the mean thrust level for a default thruster group type
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetThrusterGroupLevel(&self, th: THGROUP_HANDLE) -> f64
pub fn GetThrusterGroupLevel(&self, th: THGROUP_HANDLE) -> f64
Returns the mean thrust level for a default thruster group specified by th
Source§impl VesselContext
impl VesselContext
Sourcepub fn GroundContact(&self) -> bool
pub fn GroundContact(&self) -> bool
Returns a flag indicating contact with a planetary surface
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetSurfaceRef(&self) -> OBJHANDLE
pub fn GetSurfaceRef(&self) -> OBJHANDLE
Returns a handle to the surface reference object (planet or moon)
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetSurfaceElevation(&self) -> f64
pub fn GetSurfaceElevation(&self) -> f64
Returns the elevation of the surface at the vessel’s current longitude/latitude above the reference radius
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetAltitude(&self) -> f64
pub fn GetAltitude(&self) -> f64
Returns altitude above mean ellipsoid
Source§impl VesselContext
impl VesselContext
Sourcepub fn GetRelativeVel(&self, href: OBJHANDLE, rel_vel: &mut VECTOR3)
pub fn GetRelativeVel(&self, href: OBJHANDLE, rel_vel: &mut VECTOR3)
Returns the vessel’s current velocity relative to another object
Results are returned in the ecliptic frame (ecliptic and equinox of J2000.0).
Source§impl VesselContext
impl VesselContext
Sourcepub unsafe fn ParseScenarioLineEx(&self, line: *mut c_char, status: *mut c_void)
pub unsafe fn ParseScenarioLineEx(&self, line: *mut c_char, status: *mut c_void)
Pass a line read from a scenario file to Orbiter for default processing