Load 3D figures on terrain from kml

Hello,
is there possibility to get 3D figures displayed from terrain (figures loaded from kml)? As far as I have read documentations, I found that it is possible to render 2d objects on a terrains using clampToGround:true (like lines, polygons etc. ), but nothing write about something similar to displaying 3d volume figures on terrain.

My goal is to display for example 3d volume figure, which every point of figure has relevant height depending on terrain.

Hi,

You can use the heightReference property to display different types of geometry on terrain.

Thanks,
Gabby

But i am not creating entities (like in example) by my self, i’m loading kml, so how i should add heightReference to each geometry ? How code syntax looks in my case?

my code:
var kmlDataSource = new Cesium.KmlDataSource();
var kml = ‘file.kml’;
viewer.dataSources.add(Cesium.KmlDataSource.load(kml))

It looks like you’ve tried the clampToGround constructor option for KML DataSources, correct?

You can try accessing the underlying Entity collection in the KML data source object after loading. You can then iterate through the Entities and adjust their properties as needed.

Cesium.KmlDataSource.load(kml).then((kmlData) => {
    viewer.dataSources.add(kmlData);
    const values = kmlData.entities.values;
    for (let i = 0; i < values.length; i++) {
        const entity = values[i];
        // Add any entity code here
    }
});