Facebook
From Sludgy Human, 2 Months ago, written in C#.
Embed
Download Paste or View Raw
Hits: 47
  1. var DiffY = loc2.x - loc1.x;
  2. var DiffX = loc2.y - loc1.y;
  3. var x = Mathf.Cos(loc2.x * Mathf.Deg2Rad) * Mathf.Sin(DiffX * Mathf.Deg2Rad);
  4. var Y = Mathf.Cos(loc1.x * Mathf.Deg2Rad) * Mathf.Sin(loc2.x * Mathf.Deg2Rad) - Mathf.Sin(loc1.x * Mathf.Deg2Rad) * Mathf.Cos(loc2.x * Mathf.Deg2Rad) * Mathf.Cos(DiffX * Mathf.Deg2Rad);
  5. var BearingAngle = Mathf.Atan2(x, Y) * 180 / Mathf.PI;
  6. if (BearingAngle < 0)
  7. {
  8. BearingAngle = 360 + BearingAngle;
  9. }
  10.