Skip to content

Commit

Permalink
Fix height value for positioning tileset at the bounding sphere center
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Jan 19, 2020
1 parent 4c6a296 commit 8055591
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Apps/Sandcastle/gallery/3D Tiles Clipping Planes.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@
// The clipping plane is initially positioned at the tileset's root transform.
// Apply an additional matrix to center the clipping plane on the bounding sphere center.
var transformCenter = Cesium.Matrix4.getTranslation(tileset.root.transform, new Cesium.Cartesian3());
var height = Cesium.Cartesian3.distance(transformCenter, tileset.boundingSphere.center);
var transformCartographic = Cesium.Cartographic.fromCartesian(transformCenter);
var boundingSphereCartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
var height = boundingSphereCartographic.height - transformCartographic.height;
clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0.0, 0.0, height));
}

Expand Down

0 comments on commit 8055591

Please sign in to comment.