Skip to content

Instantly share code, notes, and snippets.

View gomker's full-sized avatar

Derek Lane gomker

  • Rackspace Hosting
  • San Antonio
View GitHub Profile
public double TrueAlt()
{
Vector3 pos= this.part.transform.position; //or this.vessel.GetWorldPos3D()
double ASL = FlightGlobals.getAltitudeAtPos(pos);
if (this.vessel.mainBody.pqsController == null) { return ASL; }
double terrainAlt = this.vessel.pqsAltitude;
if (this.vessel.mainBody.ocean && terrainAltitude <= 0) { return ASL; } //Checks for oceans
return ASL - terrainAlt;
}