What is difference between Entity and Primitive in Cesium.js? In my application I am using primitives and this (choose Drill Down Picking) uses Entities. I want to implement same highlighting functionality but with Primitives. How can I achieve this?
The difference between Entity API and Primitive API is discussed in the first couple paragraphs of this tutorial. Primitives are lower-level graphical elements within Cesium, and Entities are built on top of Primitives. A single Entity may represent a point-of-interest or a moving vehicle, and that single Entity may contain several different kinds of Primitives: A label primitive, a billboard primitive, a path / polyline primitive, etc.
Generally, the Cesium team recommends using Entities where possible, since they more directly correspond to real-world objects. But the Primitive API is public and accessible for more low-level control of the graphics display.
In the demo you referenced, look near the end of the drill-picking function, which is a long one. You'll find this line of code which actually drill-picks the primitive and then looks up the owner entity. Picking the graphics primitive is the default behavior here, you can just skip the entity lookup if you're not using entities.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With