title: Arc lines between 2 objects on a sphere Unity3D
body: <p>I need a little help with maths for drawing lines between 2 points on a sphere. I have a 3d globe and some markers on it. I need to draw curved line from point 1 to point 2. I managed to draw lines from point to point with LineRenderer, but they are drawn with the wrong angle and I can't figure out, how to implement lines that go at the right angle. The code by far:</p>
  <pre><code> public static void DrawLine(Transform From, Transform To){
      float count = 12f;
      LineRenderer linerenderer;
      GameObject line = new GameObject(&quot;Line&quot;);
      linerenderer = line.AddComponent&lt;LineRenderer&gt;();
    
      var points = new List&lt;Vector3&gt;();
      Vector3 center = new Vector3(
          (From.transform.position.x + To.transform.position.x) / 2f,
          (From.transform.position.y + To.transform.position.y) ,
          (From.transform.position.z + To.transform.position.z) / 2f
      );
  
      for (float ratio = 0; ratio &lt;= 1; ratio += 1 / count)
      {
          var tangent1 = Vector3.Lerp(From.position, center, ratio);
          var tangent2 = Vector3.Lerp(center, To.position, ratio);
          var curve = Vector3.Lerp(tangent1, tangent2, ratio);
  
          points.Add(curve);
      }
  
      linerenderer.positionCount = points.Count;
      linerenderer.SetPositions(points.ToArray());
  }
  </code></pre>
  <p>So what I have now is creepy lines rising above along y axis:
  <a href="https://i.stack.imgur.com/R5jYj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R5jYj.png" alt="screenshot" /></a></p>
  <p>What should I take into account to let lines go along the sphere?</p>