CesiumGS / cesium-unity

Bringing the 3D geospatial ecosystem to Unity
https://cesium.com/platform/cesium-for-unity/
Apache License 2.0
358 stars 83 forks source link

Fix "True Origin" inversion issue #495

Closed j9liu closed 2 months ago

j9liu commented 2 months ago

I forgot that Unity is left-handed, so I accidentally left out the y-inversion necessary to get to a left-handed coordinate system. Unfortunately I didn't catch this in #493 because I was using a symmetrical model, but it became very obvious when testing with the TextureSettingsTest model

kring commented 2 months ago

Thanks @j9liu. I checked the math a little more closely this time, and agree it's correct now. The way I think about it is that a glTF, after it's had the Y-up to Z-up transformation applied by 3D Tiles, can be thought of as having an East-North-Up axis order. By swapping the Y and Z axes (which is what the matrix now does), we end up matching the East-Up-North axis order used by the CesiumGeoreference to map the globe into the Unity world.

I'm going to separate this from the double-sided branch so we can include it even if don't end up shipping that this release.

kring commented 2 months ago

Closing this now that #498 is merged and this branch has no additional changes.