If there are primitive objects, label objects, and Cesium3Dtile objects in my scene, when I click on one of these three types of objects, how do I judge their types?
Hi @Yi-Long,
Thank you for your question! Iām assuming that you are able to select any of your assets and view an InfoBox
that contains information about the asset. For instance, when you select a Label, you might see information about the location of the label as well as the ID of the label. One option would be to update the metadata of each object in your scene to reflect its data type. Then, you would be able to tell what kind of object you selected.
It seems likely that there is a more robust solution that I am not aware of. Any input from the rest of the community would be much appreciated
Best,
Sam
Use Scene#pick()
, write a click listener with ScreenSpaceEventHandler
, log things you picked. Then you will know.
Thank you for your reply. This is the way I can think of at the moment. I thought there would be typeof, instanceof, which is a more convenient solution. I also thought about re-inheriting the interfaces of Cesium3Dtile, label, and billboard to provide some type identifiers. I guess this is more ideal, but it seems to complicate my problem more, so I choose the former.
Best,
Yi-Long
Thanks for your answer
This would work great as well!