Hello Cesium community,
I am having some trouble with the sampleHeightMostDetailed function using the objectsToExclude option. As per documentation I am passing an array of objects to exclude from the sampling and when using entities for this, it seems to work no problem. However when I try to ignore a 3dtile feature (a building feature from a 3dtileset) it doesn’t seem to work.
In detail, what I want to do is sample 3dtiles that represent a floodheight beneath the building. So I drillpick, grab the building and pass it to sampleHeighMostDetailed to exclude, but it doesn’t seem to work as expected. I have tried to passing the entire object, .primitive, .content, .tileset, .content.tileset and .content.tile but nothing seems to work. So my question is, what object do I need to pass to the function for it to ignore the 3dtilefeature? The result height of the 2 heightsamples is always identical. Below is a snippet of the code I am using inside a setInputAction function.
...
const scene = viewer.scene;
let position: any;
const cartesian: any = scene.pickPosition(input.position, position);
const cartographic: any = Cesium.Cartographic.fromCartesian(cartesian);
const terrainHeight = await Cesium.sampleTerrainMostDetailed(terrain, [cartographic]);
const tHeightForCalc = terrainHeight[0].height;
const objectsToIgnore = [];
const drillPick: any = scene.drillPick(input.position);
console.log(drillPick); // length always 2, 0 is always building, 1 is always floodtiles
for (let i = 0; i < drillPick.length - 1; i++) {
if (drillPick[i].tileset) {
objectsToIgnore.push(drillPick[i].primitive);
}
}
console.log(objectsToIgnore);
const tilesHeight = await scene.sampleHeightMostDetailed([cartographic], objectsToIgnore);
// floodtiles height expected but returns building height
const bldgHeight = await scene.sampleHeightMostDetailed([cartographic]); // same height as above
Best Regards,
Jacques