Coordinate Systems
A map of the entire Earth would be too large to fit within Unity’s coordinate space. Beyond that, the large distances involved cause problems with low-precision floating point math.
The WRLD Unity SDK provides two options for coordinate systems which solve these problems: “Unity World Space” and “ECEF Space”. Each has its pros and cons which will be outlined below.
Unity World Space
This is the default coordinate system and the simplest to use. It centers a latitude and longitude at (0, 0) in Unity’s coordinate system and positions all meshes relative to that point flat on the ground.
This allows you to use Unity’s vector math, cameras, physics, and lighting without requiring any extra steps.
For a demonstration of this coordinate system in use, open the Wrld/Scenes/UnityWorldSpace.unity
scene.
Pros:
- Easy to use
- Y-axis always points up
- Camera can be controlled as normal
Cons:
- Map position is less accurate when moving large distances away from the origin
- Switching between far away points on the globe has a few issues
ECEF Space
The ECEF (Earth-Centered Earth-Fixed) coordinate system is geographically accurate and very closely represents the curvature of the Earth.
In this coordinate system, the map will be facing a different direction depending on which area of the globe is in view.
For a demonstration of this coordinate system in use, open the Wrld/Scenes/EcefSpace.unity
scene.
Pros:
- No limitations when moving across the globe
- Camera calculations handled through WRLD SDK scripts
- Accurate rendering with no offset or distortion
Cons:
- Requires extra steps to position lights, cameras, and models correctly
- Requires using a tangent basis to perform vector calculations relative to the Earth’s surface
If you are not sure which coordinate system to use, Unity World Space is recommended as the simpler option.
If you do need to use ECEF Space, you can read more about it here.