Class AircraftFuelTank
Represents a fuel tank that stores fuel and affects aircraft center of mass and total weight. Position in the aircraft hierarchy should match the physical fuel tank location.
Implements
Namespace: NWH.Aerodynamics.AircraftController.Fuel
Assembly: NWH.Aerodynamics.dll
Syntax
public class AircraftFuelTank : MonoBehaviour, IMassAffector
Remarks
Implements IMassAffector to integrate with the VariableCenterOfMass system. As fuel is consumed, the tank's mass decreases (assuming 0.8 kg/liter fuel density), shifting the aircraft's CG and affecting flight characteristics. Tank position influences moment arms for pitch/roll behavior changes during fuel burn.
Fields
| Edit this page View Sourcecapacity
Maximum fuel storage capacity of this tank (in liters). Cannot be exceeded when refueling.
Declaration
[SerializeField]
[Tooltip("Fuel capacity in liters.")]
public float capacity
Field Value
| Type | Description |
|---|---|
| float |
Properties
| Edit this page View SourceAmount
Gets or sets current fuel amount (in liters). Cannot be negative. Consumed by AircraftFuelManager based on engine demands.
Declaration
public float Amount { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Capacity
Gets or sets the maximum tank capacity (in liters). Cannot be negative.
Declaration
public float Capacity { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
FuelPercentage
Current fuel level as a percentage of capacity (0-1 range). Use for fuel gauge displays and warnings.
Declaration
public float FuelPercentage { get; }
Property Value
| Type | Description |
|---|---|
| float |
HasFuel
Returns true if tank contains any fuel.
Declaration
public bool HasFuel { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceGetMass()
Calculates current fuel mass in kilograms using 0.8 kg/liter density (typical for aviation fuel). Used by VariableCenterOfMass system for dynamic weight distribution.
Declaration
public float GetMass()
Returns
| Type | Description |
|---|---|
| float | Fuel mass in kilograms |
GetTransform()
Returns the Transform component for IMassAffector position tracking.
Declaration
public Transform GetTransform()
Returns
| Type | Description |
|---|---|
| Transform |
GetWorldCenterOfMass()
Returns the world-space position of the fuel tank's center of mass for IMassAffector integration.
Declaration
public Vector3 GetWorldCenterOfMass()
Returns
| Type | Description |
|---|---|
| Vector3 |