How to move entities that are under terrain to the top of it?

238 views
Skip to first unread message

micael...@gmail.com

unread,
Aug 23, 2018, 12:01:00 PM8/23/18
to cesium-dev
I'm drawing some entities with data that I get from a service.

However, the height values that I get always put the entities under the terrain. Is it possible to detect this and move them to the top of the terrain?

Thanks in advance.

Omar Shehata

unread,
Aug 24, 2018, 3:25:25 PM8/24/18
to cesium-dev
Most entity types should have a `heightReference` property that'll allow you to clamp it to the ground (see https://cesiumjs.org/Cesium/Build/Documentation/HeightReference.html#.CLAMP_TO_GROUND )


For example, when creating a point (https://cesiumjs.org/Cesium/Build/Documentation/PointGraphics.html) you can set the heightReference to `Cesium.HeightReference.CLAMP_TO_GROUND` and that'll ensure it's always above ground on the terrain. Here's a Sandcastle example:

Reply all
Reply to author
Forward
0 new messages