Gravity Engine 12.0
Unity Asset for Gravity
Loading...
Searching...
No Matches
RocketEngine Class Referenceabstract

Rocket Engine Interface Used to update acceleration in the massless body engine on a per-integration step basis. More...

Inheritance diagram for RocketEngine:
GEExternalAcceleration MultiStageEngine OneStageEngine

Public Member Functions

abstract void SetThrustAxis (Vector3 thrustAxis)
 Set the thrust axis. May be over-ridden to update internals if they exist.
 
abstract double[] acceleration (double time, GravityState gravityState, ref double massKg)
 Determine the acceleration at the specified time. The accleration returned must be in the physical units used by the integrators. For GE units other than DIMENSIONLESS this will involve some use of GravityScalar conversion functions. See the MultiStageEngine implementation for an example.
 
abstract void SetEngine (bool state)
 Set engine state to on.
 
bool IsEngineOn ()
 
abstract void SetThrottlePercent (float throttle)
 Set the engine throttle level (as a percent).
 
abstract float GetThrottlePercent ()
 
abstract float GetFuel ()
 Get the current fuel remaining.
 
void SetRotation (Quaternion rotation)
 
double[] acceleration (double time, GravityState gravityState, ref double massKg)
 Determine the acceleration at the specified time for the provided gravity state.
 

Public Attributes

bool engineOn
 state of engine (or the active stage of a multi-stage engine)
 
Vector3 thrustAxis
 direction of thrust. Must be unit length.
 

Protected Attributes

Vector3 accelDirection
 "live" thrust vector reflecting orientation of ship model
 

Detailed Description

Rocket Engine Interface Used to update acceleration in the massless body engine on a per-integration step basis.

Rocket engines are used for continuous application of force over a significant time (unlike Maneuver which is used for an impulse change).

Only one GEExternalAcceleration component can be added to an NBody. If a RocketEngine plus atmosphere drag is required, then a wrapper class (e.g. EarthRocket) is needed to combine the external acceleration from the engine and the atmosphere.

The acceleration provided the engine must be adjusted to the GE internal units.

Concept: By putting engine code deep in the integrator get several advantages:

  • per integration step accuracy for rocket eqn
  • ability to do trajectory prediction
  • ability to timescale/timeZoom

Bear in mind that the acceleration function can be called for the live scene as well as for trajectory prediction. If the implementing class is supporting trajectory prediction then it needs to either be stateless or aware of when acceleration for trajectories are being computed.

Member Function Documentation

◆ acceleration()

abstract double[] RocketEngine.acceleration ( double  time,
GravityState  gravityState,
ref double  massKg 
)
pure virtual

Determine the acceleration at the specified time. The accleration returned must be in the physical units used by the integrators. For GE units other than DIMENSIONLESS this will involve some use of GravityScalar conversion functions. See the MultiStageEngine implementation for an example.

When used in trajectory mode, this function may be called more than once for a given time, and as thrust changes. It will also be called for future times to determine the future path of the rocket.

Parameters
timetime for which the thrust should be determined.
Returns
acceleration in [0..2], mass in [3]

Implements GEExternalAcceleration.

Implemented in MultiStageEngine, and OneStageEngine.

◆ GetFuel()

abstract float RocketEngine.GetFuel ( )
pure virtual

Get the current fuel remaining.

Returns
Amount of fuel in the current stage

Implemented in MultiStageEngine, and OneStageEngine.

◆ SetEngine()

abstract void RocketEngine.SetEngine ( bool  state)
pure virtual

Set engine state to on.

Parameters
state

Implemented in MultiStageEngine, and OneStageEngine.

◆ SetThrottlePercent()

abstract void RocketEngine.SetThrottlePercent ( float  throttle)
pure virtual

Set the engine throttle level (as a percent).

Parameters
throttle

Implemented in MultiStageEngine, and OneStageEngine.

◆ SetThrustAxis()

abstract void RocketEngine.SetThrustAxis ( Vector3  thrustAxis)
pure virtual

Set the thrust axis. May be over-ridden to update internals if they exist.

Parameters
thrustAxis

Implemented in MultiStageEngine, and OneStageEngine.


The documentation for this class was generated from the following file: