Gravity Engine 12.0
Unity Asset for Gravity
Loading...
Searching...
No Matches
MultiStageEngine Class Reference
Inheritance diagram for MultiStageEngine:
RocketEngine GEExternalAcceleration

Public Member Functions

override void SetThrustAxis (Vector3 thrustAxis)
 Set the thrust axis. May be over-ridden to update internals if they exist.
 
override void SetEngine (bool on)
 Set engine state to on.
 
override void SetThrottlePercent (float throttlePercent)
 Set the engine throttle level (as a percent).
 
override 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.
 
override float GetFuel ()
 Gets the fuel for the active stage.
 
void NextStage ()
 Start the next stage.
 
override float GetThrottlePercent ()
 
- Public Member Functions inherited from RocketEngine
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

double payloadMass
 mass of payload (kg)
 
int numStages
 
int activeStage
 currently active stage - stages less than this are assumed jetisoned
 
double[] massFuel
 Stage masses will be allocated by inspector script on first access.
 
double[] massStageEmpty
 mass of empty stage
 
double[] burnRate
 burn rate in kg/sec
 
double[] crossSectionalArea
 cross sectional area in m^2 for drag calculations
 
double[] coeefDrag
 drag co-efficient (dimensionless, typically about 2.1)
 
double[] thrust
 thrust of engine in N
 
GameObject[] effectObject
 Particle effect object (flame etc.) for a stage. Set to active when engine is on.
 
- Public Attributes inherited from RocketEngine
bool engineOn
 state of engine (or the active stage of a multi-stage engine)
 
Vector3 thrustAxis
 direction of thrust. Must be unit length.
 

Static Public Attributes

const int MAX_STAGES = 10
 Implementation for a multi-stage stage rocket with atmospheric drag that depends on velocity and altitude.
 

Additional Inherited Members

- Protected Attributes inherited from RocketEngine
Vector3 accelDirection
 "live" thrust vector reflecting orientation of ship model
 

Member Function Documentation

◆ acceleration()

override double[] MultiStageEngine.acceleration ( double  time,
GravityState  gravityState,
ref double  massKg 
)
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 RocketEngine.

◆ GetFuel()

override float MultiStageEngine.GetFuel ( )
virtual

Gets the fuel for the active stage.

Parameters
time
Returns

Implements RocketEngine.

◆ GetThrottlePercent()

override float MultiStageEngine.GetThrottlePercent ( )
virtual

Implements RocketEngine.

◆ NextStage()

void MultiStageEngine.NextStage ( )

Start the next stage.

Returns

◆ SetEngine()

override void MultiStageEngine.SetEngine ( bool  state)
virtual

Set engine state to on.

Parameters
state

Implements RocketEngine.

◆ SetThrottlePercent()

override void MultiStageEngine.SetThrottlePercent ( float  throttle)
virtual

Set the engine throttle level (as a percent).

Parameters
throttle

Implements RocketEngine.

◆ SetThrustAxis()

override void MultiStageEngine.SetThrustAxis ( Vector3  thrustAxis)
virtual

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

Parameters
thrustAxis

Implements RocketEngine.

Member Data Documentation

◆ massFuel

double [] MultiStageEngine.massFuel

Stage masses will be allocated by inspector script on first access.

mass of fuel in kg

◆ MAX_STAGES

const int MultiStageEngine.MAX_STAGES = 10
static

Implementation for a multi-stage stage rocket with atmospheric drag that depends on velocity and altitude.


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