代碼為:
polylineGeometry = viewer.entities.add({ name: "newPolygon", polyline: { positions: new CallbackProperty(e => { return tempPoints; }, false), clampToGround: true,//貼地畫線 width: 5.0, material: new PolylineGlowMaterialProperty(cesiumColor.GOLD), depthFailMaterial: new PolylineGlowMaterialProperty(cesiumColor.GOLD), } });
貼地划線的主要代碼為:clampToGround: true,//貼地畫線,加上后就可以進行線貼地了。
效果如下:

