Closed Draco18s closed 6 years ago
This isn't just a WRLD issue, it's a precision limitation in Unity's rendering depth buffer (and other more subtle systems, such as the physics engine). The commonly implemented workaround is to reset your game world's position in discrete steps to keep the camera relatively near to the origin. Here's a talk on the subject: https://unity3d.com/learn/resources/talks/gis-terrain-unity
Yep! Some more information is covered on this at https://wrld3d.com/unity/latest/docs/examples/coordinate-systems/ and there's two ways to resolve it with WRLD:
Simply update the Origin Point of the map via Api.Instance.SetOriginPoint(new LatLong(40.315813, -75.676385));
- this repositions the world so that the specified Lat Lon is now at Unity's origin. As mentioned if you keep moving around large distances you'd want to do this regularly.
Switch to ECEF World Space, as described above, which allows for planetary scale movement and works by keeping the camera close to the origin and shifting the world around instead.
.
This World Space doesn't work well with Unity's default lighting or physics, since the world is now represented as a sphere, so depending on your use case it's probably worth going with option 1.
Step 1: set up the scene, leave the start location alone. It doesn't matter what it's settings are (the default is
(37.6058, -122.401)
).Step 2: create this monobehaviour script and attach it to the main camera:
Step 3: Rotate the camera and watch the Z-Fight commence. More visible in scene view.