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
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.
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.
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.