
gltf added through entity model still displayed on canvas after deleting*
I add gltf model with pos
viewer.entities.add({
id: entityId,
position: position,
orientation: orientation,
model: {
uri: modelUrl,
minimumPixelSize: 128,
maximumScale: 20000,
scale: 10
}
});
but before adding it I delete if this entity already exists
if (entityToRemove !== undefined) {
viewer.entities.remove(entityToRemove);
}
We receive events to change pos and they can be fast , but I also checked the events list and I can see list getting reduced and the entity ti be deleted is also not present.
In 1 sec we can receive 15 times req to change position so gltf model changes its pos but why does the earlier one not deleted eventhough it does not show in entitiies list.
I am not sure what is the issue.
You probably should not re-create the model each time when you only want to update the position. It should be possible to use a PositionProperty for the entity. One example could be Cesium Sandcastle
In general, to receive better help quicker, should should try to post a Sandcastle that shows your problem.
Hi thanks for replying,
This worked - changing position of the model.
But there is another usecase -
If we recevive different gltf model every second then how do we clear the previous gltf model and load the next one.
Note: Even the position is also changing.
We are trying to display antenna pattern.
This sandcastle shows that it is possible to remove entities:
So there is something wrong in your code.
I have made a lot of progress. I am able to change the position of an existing entitiy that has a model.
But we have a requirement where we can get updated gltf model data in a very short time , like 10 times in a second.
I am using this code
if (existingEntity) {
existingEntity.model.uri = modelUrl;
} else {
viewer.entities.add({
id: entityId,
position: nodePosition,
model: {
uri: modelUrl,
minimumPixelSize: 128,
maximumScale: 20000,
scale: 10
}
});
}
But sometimes the previous model data is still there. What can we do in this case ?
I have used aync and await in all these cases. But sometimes this issue occurs.
Sorry for not able to provide sandcastle setup , but I am unable to get varying gltf model and load them in a single pos in cesium canvas.
TO be specific , can we use await for this existingEntity.model.uri = modelUrl;
Is there any other method that tells that loading is in progress ?