Based on the picking tutorial, I am using scene.pick(movement.endPosition) to determine which point of a PointPrimitiveCollection is selected on MouseMove.
I am unable to get/set the color property of this object. I can read the ID but then I’m not sure how to modify the color.
Main code:
// the collection
var points = scene.primitives.add(new Cesium.PointPrimitiveCollection());
// then each point is added
points.add({
id: someid,
position : new Cesium.Cartesian3.fromDegrees(lon,lat),
color: new Cesium.Color(1, 0.01, 0.01, 1),
pixelSize : 20
});
// then picked
var pickedObject = scene.pick(movement.endPosition);
``
I want to get the point itself via pickedObject.id
It’s worth noting that I have 100k+ points so storing an extra array and looping through might not be ideal.
how do i restore the point to its original color once the mouse moves out of the point? i tried applying a CallbackProperty but couldn’t figure it out.
This is the right idea, but from what I can tell there’s only going to be one point picked at a time, so you could store the picked point in a variable instead of an array. This way it is also easy to check if the same point is picked on the next mousemove, and only to change the color if a different point is picked.