public override void OnUpdate() { needle.localRotation = Quaternion.Euler(0f, 0f, rollDirection * shipHeading.getRoll(refTransform, Firespitter.Tools.WorldUp(vessel))); if (useOffset) { pitch = shipHeading.getPitch(refTransform, Firespitter.Tools.WorldUp(vessel)); if (pitch > 90f) { pitch -= 180f; pitch *= -1f; } if (pitch < -90f) { pitch += 180f; pitch *= -1f; } if (testCage) { discMat.SetTextureOffset("_MainTex", new Vector2(0f, cageOffset)); } else { discMat.SetTextureOffset("_MainTex", new Vector2(0f, Mathf.Clamp(pitch * pitchOffsetMultiplier, -pitchOffsetLimit, pitchOffsetLimit) + cageOffset)); } } }
// Update is called once per frame public override void OnUpdate() { //.LookAt(refDirection.forward, new Vector3(0f, 1f, 0f)); //needle.rotation = Quaternion.LookRotation(refDirection.forward, Firespitter.Tools.worldUp(vessel)); needle.localRotation = Quaternion.Euler(0f, 0f, rollDirection * shipHeading.getRoll(refTransform, Firespitter.Tools.WorldUp(vessel))); if (useOffset) { pitch = shipHeading.getPitch(refTransform, Firespitter.Tools.WorldUp(vessel)); if (pitch > 90f) { pitch -= 180f; pitch *= -1f; } if (pitch < -90f) { pitch += 180f; pitch *= -1f; } if (testCage) { discMat.SetTextureOffset("_MainTex", new Vector2(0f, cageOffset)); } else { discMat.SetTextureOffset("_MainTex", new Vector2(0f, Mathf.Clamp(pitch * pitchOffsetMultiplier, -pitchOffsetLimit, pitchOffsetLimit) + cageOffset)); } } //if (angleJoint != null) // angleJoint.localRotation = Quaternion.Euler(new Vector3(Mathf.Clamp(getPitch()*-0.2f, -5f, 5f), 0f, 0f)); //Debug.Log(getRoll()); }
private void menuFlightData() { updateFlightData(); updateFuel(); int i = 0; // putting ++i in the [] gives it the value before incrementation textArray[++i] = "climbRate: " + climbrateString; textArray[++i] = "radar alt: " + radarAltitudeString; textArray[++i] = "sea alt : " + altitudeString; textArray[++i] = "speed : " + speedString; textArray[++i] = "heading : " + Math.Round(FlightGlobals.ship_heading, 1).ToString().PadLeft(6) + " deg"; textArray[++i] = "hover ht.: " + hoverString; //Vector3 orientation = Firespitter.Tools.ShipHeading.orientation(vessel); Vector3 worldUp = Firespitter.Tools.WorldUp(vessel); refTransform.position = vessel.ReferenceTransform.position; // part.transform.position; // refTransform.rotation = Quaternion.LookRotation(vessel.ReferenceTransform.up, -vessel.ReferenceTransform.forward); //refTransform.rotation = vessel.ReferenceTransform.rotation; // part.transform.rotation; //Vector3 pitch = shipHeadingTool.getPitchRaw(refTransform, worldUp); //Vector3 roll = shipHeadingTool.getRollRaw(refTransform, worldUp); float pitch = shipHeadingTool.getPitch(refTransform, worldUp); float roll = shipHeadingTool.getRoll(refTransform, worldUp); textArray[++i] = "pitch" + Math.Round(pitch, 1).ToString().PadLeft(6) + " deg"; textArray[++i] = "roll" + Math.Round(roll, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "pitchX" + Math.Round(pitch.x, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "pitcY" + Math.Round(pitch.y, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "pitchZ" + Math.Round(pitch.z, 1).ToString().PadLeft(6) + " deg"; //textArray[++i] = "yaw" + Math.Round(orientation.y, 1).ToString().PadLeft(6) + " deg"; i++; foreach (KeyValuePair <string, Vector2d> kvp in resourceDictionary) { if (kvp.Key == "LiquidFuel" || kvp.Key == "ElectricCharge") { string fuelName = kvp.Key; if (kvp.Key == "ElectricCharge") { fuelName = "Battery "; } else if (kvp.Key == "LiquidFuel") { fuelName = "Lqd Fuel "; } textArray[++i] = fuelName + ": " + (int)kvp.Value.x + " / " + (int)kvp.Value.y; } } textArray[linesPerPage - 1] = "root/flight_data"; if (buttonArray[(int)ButtonNames.back]) { menuState = menuMainMenu; } clearButtons(); }