AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
AirControl.AC_Airplane_Controller Class Reference

Master Controller, controls the entire Airplane it implements function to Handle Engines, Handle Characteristics, Handle ControlSurfaces, Handle Wheel and Handle Altitude More...

Inheritance diagram for AirControl.AC_Airplane_Controller:
Collaboration diagram for AirControl.AC_Airplane_Controller:

Public Member Functions

override void Start ()
 Regulate initilaization like mass of the Vehicle, Gravity, Wheels and Characteristics More...
 
- Public Member Functions inherited from AirControl.AC_BaseRigidbody_Controller
virtual void Awake ()
 

Public Attributes

AC_BaseAirplane_Input input
 
AC_Airplane_Characteristics characteristics
 
Transform centerOfGravity
 
List< AC_Airplane_Engineengines = new List<AC_Airplane_Engine>()
 
List< AC_Airplane_Wheelwheels = new List<AC_Airplane_Wheel>()
 
List< AC_Airplane_ControlSurfacecontrolSurfaces = new List<AC_Airplane_ControlSurface>()
 
Toggle IsGroundedObject
 
Toggle IsFlyingObject
 
Toggle IsTaxiingObject
 

Protected Member Functions

override void HandlePhysics ()
 Handles physics related to Engine, Characteristics, Control surfaces wheel and Altitude More...
 

Properties

float CurrentMSL [get]
 
float CurrentAGL [get]
 
UnityEngine.Vector3 AngularVelocity [get]
 
UnityEngine.Vector3 LinearVelocity [get]
 

Additional Inherited Members

- Protected Attributes inherited from AirControl.AC_BaseRigidbody_Controller
Rigidbody rb
 
AudioSource aSource
 

Detailed Description

Master Controller, controls the entire Airplane it implements function to Handle Engines, Handle Characteristics, Handle ControlSurfaces, Handle Wheel and Handle Altitude

Definition at line 22 of file AC_Airplane_Controller.cs.

Member Function Documentation

◆ HandlePhysics()

override void AirControl.AC_Airplane_Controller.HandlePhysics ( )
inlineprotectedvirtual

Handles physics related to Engine, Characteristics, Control surfaces wheel and Altitude

Reimplemented from AirControl.AC_BaseRigidbody_Controller.

Definition at line 305 of file AC_Airplane_Controller.cs.

306  {
307  if(input)
308  {
309  HandleEngines();
310  HandleCharacteristics();
311  HandleControlSurfaces();
312  HandleWheel();
313  HandleAltitude();
314  }// handle else
315 
316  // DB based update
317 
318  }

◆ Start()

override void AirControl.AC_Airplane_Controller.Start ( )
inlinevirtual

Regulate initilaization like mass of the Vehicle, Gravity, Wheels and Characteristics

Reimplemented from AirControl.AC_BaseRigidbody_Controller.

Definition at line 117 of file AC_Airplane_Controller.cs.

118  {
119  base.Start();
120  airplaneWeight = (float)CommonFunctions.airplanePreset[CommonFunctions.activeAirplane+"/airplaneWeight"];
121  //calculate final mass in kilos
122  float finalMass = airplaneWeight * poundToKilos;
123  startPos_x = rb.position.x;
124  startPos_y = rb.position.y;
125  startPos_z = rb.position.z;
126  startRot_x = rb.rotation.eulerAngles.x;
127  startRot_y = rb.rotation.eulerAngles.y;
128  startRot_z = rb.rotation.eulerAngles.z;
129  Debug.LogFormat("Starting Position x : {0} y: {1} z: {2} ",startPos_x, startPos_y, startPos_z );
130  Debug.LogFormat("Starting Rotation x : {0} y: {1} z: {2} ",startRot_x, startRot_y, startRot_z );
131  // linear & angular; Velocity & Acceleration
132  lastLinearVelocity = rb.velocity;
133  lastAngularVelocity = rb.angularVelocity;
134 
135  // if rigid body added then add center of mass
136  if (rb){
137  rb.mass = finalMass;
138  if(centerOfGravity){
139  rb.centerOfMass = centerOfGravity.localPosition;
140  } // handel exception
141 
142  // Initialize Airplane characteristics
143  characteristics = GetComponent<AC_Airplane_Characteristics>();
144  if(characteristics){
145  characteristics.InitCharacteristics(rb, input);
146  }
147 
148  }
149 
150  // Initialize Wheels
151  if (wheels != null){
152  if(wheels.Count>0){
153  foreach(AC_Airplane_Wheel wheel in wheels){
154  wheel.initWheel();
155  }
156  }
157  }
158  InvokeRepeating("CheckGrounded", 1f, 1f);
159  // InvokeRepeating("DetectAirplaneStuck", 5f, 5f);
160  }

The documentation for this class was generated from the following file:
AirControl.AC_Airplane_Characteristics.InitCharacteristics
void InitCharacteristics(Rigidbody curRB, AC_BaseAirplane_Input curInput)
Initialize Airplane Charatceristics
Definition: AC_Airplane_Characteristics.cs:90