How to draw a Geometry to follow Terrain, and scale when zooming in and out


Currently I have a piece of code where I need to draw a line on the terrain (with known 3D height information), as well as scale when the user zooms in and out.

Corridor works for following the terrain.

corridor: {
             width: 5.0,
             material: Cesium.Color.RED,
             positions: Cesium.Cartesian3.fromDegreesArray([lon1,lat1,lon2,lat2])

But I can't find a way to scale it.

On the otherhand, Polyline can scale easily, but I can't find a way to let it follow the terrain.

Is this situation possible?


This functionality is not currently part of Cesium. Polylines on terrain are one of our most frequently requested features and we would like to add support. However, we need to do some research to figure out the best way to implement this so it renders efficiently. We need to use a different technique than we are using for ground polygons and corridors.

In the meantime, the best workaround is to either use a corridor, or subdivide the polyline a number of times and set the position at a height based on the terrain at that location.