Cesium在3dtiles三维模型上添加标注
1 let i = 0; 2 PinBill.prototype.createBill = function () { 3 let that = this; 4 that.entity = viewer.entities.add({ 5 id: '实体' + i++, 6 position: that.myPos, 7 billboard: { 8 image: that.myCanvas, 9 scale: 0.4, 10 verticalOrigin: Cesium.VerticalOrigin.BOTTOM, 11 disableDepthTestDistance: new Cesium.CallbackProperty((time, result) => { 12 let cp = viewer.camera.positionWC.clone(); 13 let d = Cesium.Cartesian3.distance(cp, that.myPos); 14 if (d < 60) { 15 that.entity.billboard.eyeOffset=new Cesium.Cartesian3(0, 0, -d+1); 16 return Number.POSITIVE_INFINITY; 17 } else { 18 return undefined; 19 } 20 }, false), 21 eyeOffset: new Cesium.Cartesian3(0, 0, -50) 22 } 23 }); 24 }