Changing entities property on the fly

Hello Support,

I need to change the entities properties on the fly.

I need to select the entities with mouse click and need to change the entity property on the fly.

But I have an issue to do this.

My code is…

// For creating entity

pointEntity = viewer.entities.add({

position: Cesium.Cartesian3.fromDegrees(longitudeString, latitudeString, 0.0),

point: {

pixelSize:10

}

});

viewer.camera.flyTo({

destination: Cesium.Cartesian3.fromDegrees(longitudeString, latitudeString, 5000.0)

});

// For pickup the entity on mouse click.

handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);

handler.setInputAction(function (click) {

var cartesian = viewer.camera.pickEllipsoid(click.position, scene.globe.ellipsoid);

if (cartesian) {

var pickedObject= scene.pick(click.position);

viewer.entities.getById(pickedObject.id);

if (Cesium.defined(selectedObject) && (selectedObject.id === pointEntity)) {

// Here I can change the point entity property.

// problem is it is working for only recently placed point entity. But it is not working for previous point entity. For previous entity, it is not going to this if condition.

Here I am comparing strictly with point entity return type “pointEntity”.

}

}

Is there any way to find out selected entity type and need to typecast to respective entity type then I can change properties of entity.

Hello Support,

I am waiting for your solution for this problem?

Provide solution as soon as possible please.

If the entity is a point then it has a point property set to a PointGraphics, so I would do something like:

if ( ...&&(typeof(selectedObject.id.point)=="object" )

to check if the selected object is a point