How do I get Earth coordinates onto a sphere

I’m making a satellite tracking game and I need a way to transfer the 2D world coordinates into a sphere.

How can I do this?
I’ve been loking for posts and other things about this on the internet but they are all to complex for me to understand them so if anyone has an idea on how to do this I will apreciate it.
Here’s my small code that tracks the position of the ISS:

local HTTP = game:GetService("HttpService")

while true do
	wait(1)
	local Response = HTTP:GetAsync("http://api.open-notify.org/iss-now.json")
	local iss_position = HTTP:JSONDecode(Response)
	local IPO = (iss_position["iss_position"])
	print(IPO["latitude"])
	print(IPO["longitude"])	
end

Thanks, elpanlo

1 Like

I’d create an origin point in the center of the 2D space, and set a 3rd value that adjusts height accordingly on the sphere depending how far you are from the origin point.

If you were to put something like this in the loop, it should work

issPositionX = radius * math.cos(IPO["latitude"]) * math.sin(IPO["longitude"])
issPositionY = radius * math.sin(IPO["latitude"])
issPositionZ = radius * math.cos(IPO["latitude"]) * math.cos(IPO["longitude"])

and then to set the position

iss.Position = center + Vector3.new(issPositionX, issPositionY, issPositionZ)

where “center” is the location of the planet you want it to orbit, and “radius” is that planet’s width divided by 2 + how high off the surface you want it to orbit

If you haven’t considered it yet, I highly recommend using tweening to smoothly move the station from point to point otherwise it will skip forwards a large amount at a time.

This is where I got the information for converting coordinates
The examples here show the Z coordinate as up and down, so in my example I rotated the XYZ to be oriented correctly

I hope that this was helpful

2 Likes

It works, my only problem is that it adds the positions as if they were studs.

I’m trying different things like dividing the positions, in case you have an idea on how to fix this.
Here a video:

I’ve managed to slow it down but the position is not that correct, I dont know if I should test by adding real earth orientation.
Also:
It always starts from the same position.

Forget everything a guy helped me fix it. Thanks!

how did you fix it? I am trying to make something also like this