private void Start() { aircraftPhysics = FindObjectOfType <AircraftPhysics>(); if (!aircraftPhysics) { Debug.LogError("(Flight Controls) Flight controller is null on camera!"); return; } target = GameObject.FindGameObjectWithTag("Aircraft Camera Target").transform; if (!target) { Debug.LogError("(Flight Controls) Camera target is null!"); return; } }
public static void AircraftPhysicsGizmos(AircraftPhysics phys, GizmoType gizmoType) { AircraftPhysicsDisplaySettings settings = AircraftPhysicsDisplaySettings.Instance; Vector3 weight = phys.GetComponent <Rigidbody>().mass *Physics.gravity; float scale = settings.lengthScale; if (settings.scaleForcesByWeight) { scale /= weight.magnitude; } if (settings.showCenterOfMass) { Gizmos.color = settings.comColor; Vector3 com = phys.GetComponent <Rigidbody>().worldCenterOfMass; Gizmos.DrawWireSphere(com, 0.3f * settings.widthScale); DrawThinArrow(com, weight * scale, settings.comColor, 0.4f * settings.widthScale, 3); } Vector3 airspeed = new Vector3(0, Mathf.Sin(Mathf.Deg2Rad * settings.displayAngleOfAttack), -Mathf.Cos(Mathf.Deg2Rad * settings.displayAngleOfAttack)) * settings.displayAirspeed; Vector3 center; Vector3 force; phys.CalculateCenterOfLift(out center, out force, phys.transform.TransformDirection(airspeed), settings.displayAirDensity, settings.displayPitchControl, settings.displayYawControl, settings.displayRollControl); if (settings.showAerodynamicCenter) { Gizmos.color = settings.adcColor; Gizmos.DrawWireSphere(center, 0.3f * settings.widthScale); DrawThinArrow(center, force * scale, settings.adcColor, 0.4f * settings.widthScale, 3); } }
// TODO: Add fuel to the aircraft. // TODO: Count down Fuel.. Depending on the current velocity lower it faster. private void Awake() { aircraftPhysics = GetComponent <AircraftPhysics>(); if (!aircraftPhysics) { Debug.Log("ERROR: AircraftPhysics script is not found"); return; } aircraftBombHatch = GetComponent <AircraftBombHatch>(); if (!aircraftBombHatch) { Debug.Log("ERROR: AircraftBombHatch script is not found"); return; } aircraftFuelTank = GetComponent <AircraftFuelTank>(); if (!aircraftFuelTank) { Debug.Log("ERROR: AircraftFuelTank script is not found"); return; } aircraftHUD = GetComponent <AircraftHUD>(); if (!aircraftHUD) { Debug.Log("ERROR: AircraftHUD script is not found"); return; } aircraftCamera = FindObjectOfType <AircraftCamera>().GetComponent <Camera>(); if (!aircraftCamera) { Debug.Log("ERROR: AircraftCamera script is not found"); return; } }
private void Start() { aircraftPhysics = GetComponent <AircraftPhysics>(); rb = GetComponent <Rigidbody>(); }
private void Start() { aircraftPhysics = GetComponent <AircraftPhysics>(); rb = GetComponent <Rigidbody>(); autopilot = GetComponent <AutopilotAltitude>(); }
private void Start() { aircraftPhysics = GetComponent <AircraftPhysics>(); propeller = FindObjectOfType <Rotator>(); SetThrust(0); }
private void Start() { aircraftPhysics = GetComponent <AircraftPhysics>(); SetThrust(1); }