This bit of code works:
const rLine = new Cesium.GeometryInstance({
geometry: new Cesium.SimplePolylineGeometry({
positions: Cesium.Cartesian3.fromDegreesArrayHeights(posns),
colors: colorVals,
colorsPerVertex: true, }),
});
viewer.scene.primitives.add(new Cesium.Primitive({
geometryInstances: rLine,
appearance: new Cesium.PerInstanceColorAppearance({
flat: true, }),
}));
But I need to make it a PolylineGeometry because SimplePolylineGeometry doesn’t support setting the width. If I make one change to
geometry: new Cesium.PolylineGeometry({
then my line won’t appear, no console errors.
How can I make this work so I can set a line width? I take it setting width for SimplePolylineGeometry is impossible?
Also tried this which gives me just a white line at the correct width:
var polylines = viewer.scene.primitives.add(new Cesium.PolylineCollection());
var polyline = polylines.add({
positions : Cesium.Cartesian3.fromDegreesArrayHeights(posns),
colors: colorVals,
colorsPerVertex: true,
width: 5
});
I see now this is because Polyline has no mutli colour functionality but PolylineGeometry does! Not sure I Understand why there are two such similar sounding classes.