Draw shortest distance between 2 points on a sphere

Hello guys!
I’m making a game, but I encountered a problem. That looks easy to fix, but I think it’s not. I couldn’t fix that, even I waste my 2 days.

I have a sphere, it’s classic sphere primitive from the menu. I have created two empty game object and set their parents to my lovely sphere :slight_smile: I want to draw a line between 2 points. Line renderer works, but it draws straight. I want to draw a circular line between these. How can I do this? I don’t have any idea.

I want to draw a line like this(circular)

But line renderer draws like this, and so I can’t see the middle of the line, because it’s passing in the sphere. (straight)

Well there are several possibilities how you could draw this arc. Since you already use a linerenderer i may suggest using the line renderer. Of course to draw an arc you need several line segments to approximate the arc. Though the line renderer can be used for that.

The easiest solution is to simply use Vector3.Slerp with a relative vector from the sphere center to the first point as start vector and another vector from the center to the end point. When you increase the “t” value of the Slerp you get intermediate point between start and end on the sphere’s surface (of course as long as the sphere stays smooth, so no height displacements)

So just set the positionCount to 100 (or whatever you like), create a Vector3 array with that many elements and fill it using Slerp from 0 to 1 in 100 steps. Finally just use SetPositions and pass the array with the points.