Latitude and Longitude of Globe
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?
Your answer
Follow this Question
Related Questions
AngleAxis and MoveRotation not rotating around the object 0 Answers
Combine two rotation 0 Answers
Why do my physics objects rotate randomly sometimes when reparented 1 Answer
Character Rotation 0 Answers
Quaternion relative difference problem 0 Answers