Hello, I am working on a project in which I need to obtain the latitude and longitude coordinates on a globe. This is how I am currently finding these coordinates:
float lat = Mathf.Acos((hit.point.y)/((Mathf.Sqrt((radius^2)+(Mathf.Pow(hit.point.y, 2))))));
float long = Mathf.Atan2(hit.point.x,hit.point.z);
I think this may be correct to an extent, however, I am also hoping to take into account the rotation of the sphere. Users are able to rotate the globe in any direction so we would like to get the proper coordinates for where they end up. For example, if you clicked on North America (Florida) right now, you would get 29 latitude and -81 longitude. Then, when rotating to Australia, clicking on the same point on the screen, you would again get 29 and -81. Instead, I would like for the click on Australia to get -25 and 125, as it should be on a real globe. Does anyone have any advice on this?