From b6506f3dea454c16acb939de3094fd10ed3dc344 Mon Sep 17 00:00:00 2001 From: mahmoud adel <58145645+mahmoudadel54@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:21:31 +0300 Subject: [PATCH] #9163 Bug 3D Tiles offset with Google 3D tiles (#9421) --- .../components/map/cesium/plugins/ThreeDTilesLayer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/client/components/map/cesium/plugins/ThreeDTilesLayer.js b/web/client/components/map/cesium/plugins/ThreeDTilesLayer.js index 7d72c1decf..8e0d750c09 100644 --- a/web/client/components/map/cesium/plugins/ThreeDTilesLayer.js +++ b/web/client/components/map/cesium/plugins/ThreeDTilesLayer.js @@ -44,9 +44,9 @@ function getStyle({ style }) { function updateModelMatrix(tileSet, { heightOffset }) { if (!isNaN(heightOffset) && isNumber(heightOffset)) { const boundingSphere = tileSet.boundingSphere; - const cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center); - const surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0); - const offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset); + const cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center); // undefined if the cartesian is at the center of the ellipsoid + const surface = Cesium.Cartesian3.fromRadians(cartographic?.longitude || 0, cartographic?.latitude || 0, 0.0); + const offset = Cesium.Cartesian3.fromRadians(cartographic?.longitude || 0, cartographic?.latitude || 0, heightOffset); const translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3()); tileSet.modelMatrix = Cesium.Matrix4.fromTranslation(translation); }