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

Monitor and updates the Altimeter to UI More...

Inheritance diagram for AirControl.AC_Airplane_Altimeter:
Collaboration diagram for AirControl.AC_Airplane_Altimeter:

Public Member Functions

void HandleAirplaneUI ()
 Updates to UI More...
 

Detailed Description

Monitor and updates the Altimeter to UI

Definition at line 11 of file AC_Airplane_Altimeter.cs.

Member Function Documentation

◆ HandleAirplaneUI()

void AirControl.AC_Airplane_Altimeter.HandleAirplaneUI ( )
inline

Updates to UI

Implements AirControl.IAirplaneUI.

Definition at line 36 of file AC_Airplane_Altimeter.cs.

37  {
38  if(airplane)
39  {
40  float currentAltitude = airplane.CurrentMSL;
41  float currentThousands = currentAltitude/1000f;
42  currentThousands = Mathf.Clamp(currentThousands,0,10);
43 
44  float currentHundreds = currentAltitude - (Mathf.Floor(currentThousands)*1000f);
45  currentHundreds = Mathf.Clamp(currentHundreds, 0f,1000f);
46 
47  if(thousandsPointer)
48  {
49  // Calcualting degrees from the current height
50  float radialThousands = Mathf.InverseLerp(0,10,currentThousands);
51  radialThousands = 360f * radialThousands;
52  thousandsPointer.rotation = Quaternion.Euler(0f,0f,-radialThousands);
53  }
54  if(hundredspointer)
55  {
56  // Calcualting degrees from the current height
57  float radialHundreds = Mathf.InverseLerp(0f,1000f,currentHundreds);
58  radialHundreds = 360f * radialHundreds;
59  hundredspointer.rotation = Quaternion.Euler(0f,0f,-radialHundreds);
60  }
61  }
62  }

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