3d tiles with terrain

I create 3d tiles with a height of 0. When I build the land, the building objects are under the ground and render problem occurs.

How can I elevate these objects to the ground?.

3D Tiles doesn’t have a clamp to ground functionality, but you can edit a tileset’s height manually. With Cesium running locally go to the 3D Tiles Adjust Height sandcastle demo: http://localhost:8080/Apps/Sandcastle/index.html?src=3D%20Tiles%20Adjust%20Height.html&label=3D%20Tiles

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({

url : ‘…/…/…/Specs/Data/Cesium3DTiles/Tilesets/Tileset’

}));

tileset.readyPromise.then(function() {

var height = 100.0;

setHeight(tileset, height);

var boundingSphere = tileset.boundingSphere;

viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius * 2));

viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);

}).otherwise(function(error) {

throw(error);

});

function setHeight(tileset, height) {

var cartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);

var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);

var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, height);

var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());

tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);

}

``

Thank you for replying.

so how do i get the height of the terrain intersecting with the 3d tiles? is it possible?

12 Ocak 2018 Cuma 03:25:14 UTC+3 tarihinde Sean Lilley yazdı:

You can use sampleTerrain or sampleTerrainMostDetailed to get the height of terrain at a position.