How to check weather a picked feature is an Entity or Cesium3DTileFeature

I am struggling to understand how to distinguish between a Cesium3DTileFeature and an Entity that I have created while picking.

In this Sandbox I have added an entity and an OSM tileset.

This is the part of the code where I check for what I am picking

  if (pickedObject instanceof Cesium.Cesium3DTileFeature) {
    console.log("You picked a Cesium3DTileFeature");
  } else if (pickedObject.primitive) {
    console.log("You picked an entity");
  }

and it based on this answer and this example from the API docs.

Can you please help me understand what I am doing wrong?

I don’t quite get what you mean but is this what you need?

1 Like

Thanks. I really did not phrase the question that well. Apologies for the confusion.

The updated version of the sandbox shows what I was trying to achieve.

I am replacing some features from the OSM tileset with entities that have, for example, the correct height. Also, I want to access the same properties of the original OSM feature from the Entity that replaces it.

Entities and features have a different way to set and get properties (AFAIK) so I was trying to identify the type of object picked in order to use the correct method.

1 Like