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

Monitor and updates the Attitude to UI More...

Inheritance diagram for AirControl.AC_Airplane_Attitude:
Collaboration diagram for AirControl.AC_Airplane_Attitude:

Public Member Functions

void HandleAirplaneUI ()
 Updates to UI More...
 

Public Attributes

RectTransform bgRect
 
RectTransform arrowRect
 

Protected Attributes

float bankAngle
 
float pitchAngle
 
float bankAngleRad
 
float pitchAngleRad
 

Properties

float BankAngle [get]
 
float PitchAngle [get]
 

Detailed Description

Monitor and updates the Attitude to UI

Definition at line 12 of file AC_Airplane_Attitude.cs.

Member Function Documentation

◆ HandleAirplaneUI()

void AirControl.AC_Airplane_Attitude.HandleAirplaneUI ( )
inline

Updates to UI

Implements AirControl.IAirplaneUI.

Definition at line 46 of file AC_Airplane_Attitude.cs.

47  {
48  if(airplane)
49  {
50  //Create Angles
51  bankAngleRad = Vector3.Dot(airplane.transform.right, Vector3.up); // value from -1 to 1
52  bankAngle = bankAngleRad * Mathf.Rad2Deg;
53  pitchAngleRad = Vector3.Dot(airplane.transform.forward, Vector3.up); // value from -1 to 1
54  pitchAngle = pitchAngleRad * Mathf.Rad2Deg;
55 
56  //Handle UI Elements
57  if(bgRect)
58  {
59  Quaternion bankRotation = Quaternion.Euler(0f, 0f, bankAngle);
60  bgRect.transform.rotation = bankRotation;
61 
62  Vector3 wantedPosition = new Vector3(0f, -pitchAngle, 0f);
63  bgRect.anchoredPosition = wantedPosition;
64 
65  if(arrowRect)
66  {
67  arrowRect.transform.rotation = bankRotation;
68  }
69  }
70  #region DBArea
71  StaticOutputSchema.BankAngle = bankAngleRad;
72  StaticOutputSchema.PitchAngle = pitchAngleRad;
73  #endregion
74 
75  }
76  }

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