private Single GetAltitudeFromOcean(Vector3 position) { PQS ocean = GetOcean(); return((Single)ocean.GetSurfaceHeight(ocean.GetRelativePosition(position)) - (Single)Part.vessel.mainBody.Radius); }
/// <summary> /// Update the heat /// </summary> public void Update() { if (!FlightGlobals.ready) { return; } // Get all vessels List <Vessel> vessels = FlightGlobals.Vessels.FindAll(v => v.mainBody == _body); // Loop through them foreach (Vessel vessel in vessels) { Vector3 position = vessel.transform.position; Double distanceToPlanet = Math.Abs(Vector3d.Distance(position, _body.transform.position)) - _ocean.GetSurfaceHeight(_ocean.GetRelativePosition(position)); Double heatingRate = heatCurve.Evaluate((Single)distanceToPlanet); foreach (Part part in vessel.Parts) { part.temperature += heatingRate * Time.deltaTime; } } }