Dotted/dashed lines are actually difficult to do properly in 3D but they are on the roadmap (though we don’t have an ETA yet) keep an eye on this issue for updates: https://github.com/AnalyticalGraphicsInc/cesium/issues/2584
Connecting to Entities like you describe is fairly easy to do out of the box. Here’s some code you can paste into Sandcastle and play with to get started. There are several different ways to do it but they all involve creating a polyline with positions that reference the connected entities’ positions. This code is for predominately static data. If the positions of your objects are moving frequently, you’ll want to use an appropriate dynamic property (such as SampledPositionProperty). The setValue in the toolbar button is just to change the values, normally you wouldn’t do it this way unless your data was mostly static.
Hope this helps, let me know if you have any questions.
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var entity1 = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(0, 0, 10000),
label : {
text: ‘Hello!’
}
});
var entity2 =viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(0, 0, 0),
billboard : {
image : ‘…/images/Cesium_Logo_overlay.png’
}
});
var connection =viewer.entities.add({
polyline : {
positions : new Cesium.PositionPropertyArray([entity1.position, entity2.position])
}
});
Sandcastle.addToolbarButton(‘Change positions’, function(){
entity1.position.setValue(Cesium.Cartesian3.fromDegrees(Math.random()-0.5, Math.random()-0.5, 10000));
entity2.position.setValue(Cesium.Cartesian3.fromDegrees(Math.random()-0.5, Math.random()-0.5, 0));
});
viewer.zoomTo(viewer.entities);