Cannot pick polyline primitive

Why is it that the below Polyline Primitive cannot be picked despite having allowPicking set to true?

Sandcastle example (link to sandcastle):

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var scene = viewer.scene;

var primitive = new Cesium.Primitive({

geometryInstances: new Cesium.GeometryInstance({

geometry: new Cesium.PolylineGeometry({

positions: Cesium.Cartesian3.fromDegreesArrayHeights([-75, 43, 500000,

-125, 43, 500000]),

width: 2.0,

followSurface: false,

colors: [{red:1,green:0,blue:0}, {red:0,green:1,blue:1}],

colorsPerVertex: true,

vertexFormat: Cesium.PolylineColorAppearance.VERTEX_FORMAT

}),

id: ‘T01’,

attributes: {

show: new Cesium.ShowGeometryInstanceAttribute(true)

}

}),

allowPicking: true,

appearance: new Cesium.PolylineColorAppearance({

translucent: false

})

});

scene.primitives.add(primitive);

viewer.zoomTo(viewer.entities);

``

I have to use the Primitive to get the color gradient vs the Polyline Entity which doesn’t allow that. Is there a parameter I’m missing that’s required to allow it to be picked?

Hello,

The default click handling that brings up the InfoBox is built into the entity API. In order to add click handling to your polyline you will have to add your own click handler.

See the code sample I posted here for an idea for how to do to this: https://groups.google.com/d/msg/cesium-dev/rzLrPY5ERJs/VYfUj-fYCgAJ

Best,

Hannah

Oh ok thanks for the info!

I actually already have a click handler in my actual application to handle what will occur when the item is selected.

Does it only work with scene.pick() and not scene.drillPick() for Primitives?

My drillPick always comes up with an empty array when selecting the Primitives.