Cesiumjs – moving entities around

Recently I’ve been asked to allow users to move entities around in Cesiumjs.

I’ve looked at the cesium drawing plugin but was surprised to see it doesn’t support this, so I’ve decided to give it a go.

It surprised me how easy it was to implement it, especially using the powerful CallbackProperty.

Here’s the live demo (click and drag the eliipse/polygon):

You can also get the sandcastle demo if you like – download here: MovingEntitiesAround

Two methods are the source of the magic here – moveEllipse and movePolygon.

In each I create an external variable to hold the position and the hierarchy, and then I use the CallbackProperty in order to dynamically change it in the Mouse_MOVE event.

Leave a Reply