In a GroundPrimitive, how to get geometry instance on click event?

I want get a polygon geometry instance in a ground primitive when I click on the polygon.
Here is the sandcastle url: GroundPrimitive click event.


You can not, because Primitives does not store geometry instances.

If you’re the one creating the primitives then you have the data, so you can recreate parts of it. I would create a table of configs for your entities (or make it queriable through a db) and create those. Here’s a crude (very crude; don’t put the config into the id, but rather create a lookup-table of id’s → config, but you get the idea) that allows you to do a reverse lookup when you pick on those primitives;



Hi Alex, thanks for your reply! I can get id from click event. But when there are too many polygon geometry instances, the click event returns the wrong instance id. I don`t konw why. So I seperate the instances into different GroundPrimitive, which returns the right geometry while has bad performance. But this actually solves my problem. Thanks anyway! :grinning: