请问webgl多边形如何等距离拉升?即拉伸后让其顶面和底面保持平行?
我拉升出来顶总是水平的,如下
$('#add1').click(function () {
var wyoming = viewer.entities.add({
name: 'Wyoming',
polygon: {
//给出位置
hierarchy: {
//北京
"positions": [
{x: -2179346.585747059, y: 4380624.547842732, z: 4091827.5920672156},
{x: -2179326.18266688, y: 4380597.232766587, z: 4091650.430482225},
{x: -2179419.016835975, y: 4380586.881099812, z: 4091830.019196045}]
// 昆明1
// "positions": [
// {x: -1265727.9716051277, y: 5645127.683848716, z: 2691044.259410294},
// {x: -1266636.5386668867, y: 5644736.920310809, z: 2690237.3250578623},
// {x: -1266413.5491800145, y: 5644196.356155109, z: 2691505.055755857}]
//昆明2
// "positions": [
// {x: -1272269.2716727792, y: 5645992.620366781, z: 2684928.4282801244},
// {x: -1271006.6260239957, y: 5647504.409356054, z: 2682334.1175733428},
// {x: -1275644.188915854, y: 5646183.512151276, z: 2682913.671366511}]
},
// height: 50,//多边形底面离地高度,如果要采用底面的Z值,启用perPositionHeight属性,height属性无效。
extrudedHeight:200,//多边形突出面离地高度
// extrudedHeightReference:3000,
perPositionHeight:true,
// heightReference:,
//材质(相当于填充色,但是可以填充的可不止颜色,可以看到这里是红色半透明)
material: Cesium.Color.RED.withAlpha(0.5),
//外边线
outline: true,
outlineColor: Cesium.Color.BLACK
}
});
//这是一个动画效果,进入后镜头就会自动转到这个实体处
viewer.zoomTo(wyoming);
console.log(wyoming);
/*实体属性事后更改*/
//离地高度
// wyoming.polygon.height = 20;
//拉伸离地高度
// wyoming.polygon.extrudedHeight = 500;
});