Is it possible to show primitives to terrain(to DEM)?

Dear Team,
I’ve created a toolbar to draw points, lines, and polygons using primitives and it’s not visible on the terrain.
If I’m using entities with RELATIVE_TO_HEIGHT it’s working but not with primitives. Is there any other way to show primitives on the terrain if so please give me a suggestion?
Sample is given bellow:-
var b = new Cesium.BillboardCollection();
scene.primitives.add(b);
var billboard = b.add({
show: true,
position: event.position,
pixelOffset: new Cesium.Cartesian2(0, 0),
eyeOffset: new Cesium.Cartesian3(0.0, 0.0, 0.0),
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.CENTER,
//heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND,
// heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
// disableDepthTestDistance: Number.POSITIVE_INFINITY,
scale: 1.0,
image: ‘assets/icon/icons8-marker-24.png’,
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
});
billboard.setEditable();
$(‘.button’).css(‘background’, ‘#fff’);

Thanks

@Shashi

scene.primitives.add(b); looks correct to me. Are you experiencing any errors that make you want to find another method to add primitives?

-Sam

@sam.rothstein
It’s sloved! I was missing initialization of scene in billboard. Like before i was using var b = new Cesium.BillboardCollection(); but it should be var b = new Cesium.BillboardCollection(cesium:viewer.cesium);

Thanks

@Shashi

I am very happy to hear this! Thank you for updating the thread with your solution :grinning: :rocket:

-Sam

1 Like