From e5a119c21080b3f1c78aeb51d02126c08ce0a771 Mon Sep 17 00:00:00 2001 From: Janine Liu Date: Fri, 30 Aug 2024 15:49:51 -0400 Subject: [PATCH] Fix true origin coordinate system --- native~/Runtime/src/CesiumGeoreferenceImpl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/native~/Runtime/src/CesiumGeoreferenceImpl.cpp b/native~/Runtime/src/CesiumGeoreferenceImpl.cpp index bc069dfa..8f42e031 100644 --- a/native~/Runtime/src/CesiumGeoreferenceImpl.cpp +++ b/native~/Runtime/src/CesiumGeoreferenceImpl.cpp @@ -30,12 +30,13 @@ LocalHorizontalCoordinateSystem createCoordinateSystem( DotNet::CesiumForUnity::CesiumGeoreferenceOriginPlacement::TrueOrigin) { // In True Origin mode, we want a coordinate system that: // 1. Is at the origin, - // 2. Converts from Y-up to Z-up, and - // 3. Uses the georeference's scale + // 2. Inverts Y to create a left-handed coordinate system, + // 3. Converts from Z-up to Y-up, and + // 4. Uses the georeference's scale glm::dmat4 localToEcef( glm::dvec4(scale, 0.0, 0.0, 0.0), glm::dvec4(0.0, 0.0, scale, 0.0), - glm::dvec4(0.0, -scale, 0.0, 0.0), + glm::dvec4(0.0, scale, 0.0, 0.0), glm::dvec4(0.0, 0.0, 0.0, 1.0)); return LocalHorizontalCoordinateSystem(localToEcef); }