Hi all,
I wasn’t really sure which topic to post this question in but here felt the most appropriate as it will involve scripting.
I am trying to model a satellite in its orbit and I’ve calculated its ECEF coordinates relative to the topocentric position of La Palma. However I am unsure how to transform these ECEF coordinates into the unity coordinate system. For example , I am trying to position a camera object at the La Palma location (lat = 28.7603135, lon = -17.8796168,elevation (m) = 2387 ) which converts to
X : 5327.41 km
Y : -1718.614 km
Z : 3051.788 km
in ECEF coordinates ( Latitude/Longitude/Height <--> ECEF via J-Script). I would like to know how to transform this in the unity world-space as an example which would obviously help me transform my satellite coordinates.
Interesting, I read here that [https://discussions.unity.com/t/lat-long-to-unity-world-coordinates/133155/2] " X is forward, Y is right, D is down, which means X in ECEF is really Z in unity, Y in ECEF is X in unity, and Z in ECEF is really -Y in Unity" So I assumed that this would yield the correct transform (or at least points to a transform being needed)
The directions which you describe are just conventions, but the Y/-Y thing is about the chirality or handedness of the coordinate system. Everything outside of game development uses the right-handed coordinate system as God intended. Decades ago, Microsoft did the world a dirty, and now many game development engines including Unity use the sinister left-handed coordinate system. Thus, one coordinate in your right-handed format does need to be inverted as you convert into Unity.
See the #18 post in this thread, which I wrote some time ago, about the conventions of forward/right/up in Unity.