How do I transform ECEF (x,y,z) coordinates to Unity Coordinates

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.

Thanks,

Traditionally Unity regards 1 world unity as 1 meter.

The only place this actually matters is the Physics system because of how time advances.

Otherwise Unity is essentially dimensionless.

You’re welcome to map your ECEF thingies however works best for you.

Remember that Unity uses 32-bit floating point numbers. This means you have 6 to 9 places of decimal accuracy, no more.

That means the farther you are away from something, the less-precisely you know where it is.

If you need massive distances, track it yourself in a higher-precision format such as double, or else use a floating origin system.

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)

Not sure about all that noise.

Unity is left hand rule.

Hold your left hand up, palm outward.

Your thumb is +X

Your index finger is +Y

Your palm is +Z

Thanks, So I’m guessing I can just use all the ECEF positions I have already (Satellite position and La Palma)

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.

https://discussions.unity.com/t/587912/18