Hi all,
How do I get the value of “geometryInstance.myValue” during the mouse over event? Below is the code I have now, it doesn’t work.
var widget = new Cesium.CesiumWidget(‘cesiumContainer’);
var instances = ;
var geometryInstance = new Cesium.GeometryInstance({
geometry: new Cesium.ExtentGeometry({
extent: new Extent(
CesiumMath.toRadians(170), //west
CesiumMath.toRadians(80), //south
CesiumMath.toRadians(180), //east
CesiumMath.toRadians(90) //north
)
}),
attributes:{
color: Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1, 0, 1, 0.5))
}
});
geometryInstance.myValue = 123; // adding a value to the geometry instance.
instances.push(geometryInstance);
widget.scene.getPrimitives().add(new Cesium.Primitive({
geometryInstances: instances,
appearance: new Cesium.PerInstanceColorAppearance(),
asynchronous: false
}));
var primitives = widget.scene.getPrimitives();
var handler = new Cesium.ScreenSpaceEventHandler(widget.scene.canvas);
handler.setInputAction(function(movement) {
var p = widget.scene.pick(movement.endPosition);
if (Cesium.defined§ && primitives.contains(p.primitive)) {
alert(p.primitive.myValue); //How do I retrieve the “geometryInstance.myValue” here?
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
Thanks in advance.
Steven