Hi in cesium primitives has options to enable/disable picking, But entities do not have that,
Hi @ajinRa020307,
Thank you for your question. According to our documentation, we currently do not support disabling picking for entities. I recommend checking out this thread for more context. It is possible that there is some sort of a workaround - any suggestions from the community?
-Sam
Hey,
Which picking method are you using? There’s no disable for entities, only parameters into the pick method for entities to ignore (so, if I had an array of my entities, you can send that in). I do my own filtering when picking instead of a global control for this in the API.
Maybe explain the issue you’re having? If you want to pick something and ignore the entities, you just sniff what you picked. If you use drillPick, same story, just loop through what’s picked and ignore anything with, for example, an id object and a primitive object (ie. if ( picked.id && picked.primitive ) {…} ).
Cheers,
Alex
There’s no disable for entities, only parameters into the pick method for entities to ignore (so, if I had an array of my entities, you can send that in).
Which parameters are these? I don’t see any for scene.pick or scene.drillPick
If you want to pick something and ignore the entities, you just sniff what you picked. If you use drillPick, same story, just loop through what’s picked and ignore anything
Is there a way to do this for the picking that occurs when the left mouse button is pressed that updates viewer.selectedEntity (which looks like Viewer.pickEntity)?
Hi @srce
there are no such parameters bound to methods scene.pick
and scene.drillPick
afaik.
But Alex already provided some solution: sniffing the outcome of these methods (which of course you can do on left click, too). You can just use an if-else-statement to filter specific features and for drillPick you have to loop through the outcome.
A slightly larger code snippet of the solution provided by Alex:
handler.setInputAction(function(movement) {
const feature = scene.pick(movement.position);
if (feature.id == 'IgnoredID1' || feature.id == 'IgnoredID2') {
viewer.selectedEntity = undefined;
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
You can of course use any “parameter” for filtering, like some other property: feature.properties.exampleProperty._value == 'IgnoredValue'
Best, Lennart