Hi,
I can figure out how to determine a model has been loaded when using the Primitive API (using Model.readyPromise) but I can't figure out how to do the same thing when I load a model as part of an entity like such:
var entity = viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-75, 39),
model : {
uri : 'SampleData/models/CesiumAir/Cesium_Air.gltf'
}
});
All I am trying to do is grab the bounding sphere after the model loads. I am using the function getModelForEntity(entity) here:
https://gist.github.com/mramato/2b6becee077c664bf25d
It doesn't work when the page loads, but if I wait a few seconds and execute the function call in the console I am fine.
What am I doing wrong? Also, if there is some private API so that I can access an entities underlying primitives, I would be fine with that too but I haven't been able to figure out what it is. Perhaps they are only correlated by having the same ID?
Regards,
Nick