Hi,
I’m trying to move/resize a basic entity (i.e. ellipsoid) in real time AKA every clock tick event as part of viewer.clock.onTick.addEventListener(function(clock) {…} loop - see code example paste below.
I do use the exact same approach for other entities: i.e. model and label where all works fine.
However for ellipsoid, updating the position/radii on the fly doesn’t work = the ellipsoid is never displayed. I do suspect some internal synchronization issues that doesn’t allow ellipsoid to render before the frame is displayed but I’m not too sure…
Could anyone let me know why is that (i.e. ellipsoid difference ) and suggest how to solve this.
Thanks in advance !
//*******************************************************
//Load the CZML data into the viewer
// CZML contains LA, LO, AL, HAc,VAc data
//*******************************************************
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function(ds) {
viewer.trackedEntity = ds.entities.getById(‘path’);
dispEntity = ds.entities.getById(‘display’);
});
//*******************************************************
// Create the elliplsoid representing the flight accuracy
//*******************************************************
const AccurEntity = viewer.entities.add({
position: position,
ellipsoid: {
radii: radii,
material: Cesium.Color.RED.withAlpha(0.2),
}
});
//*******************************************************
// Display all the data synchronous with CESIUM clock
//*******************************************************
viewer.clock.onTick.addEventListener(
function(clock) {
var position = Cesium.Cartesian3.fromDegrees(
dispEntity.properties.LO.getValue(clock.currentTime),
dispEntity.properties.LA.getValue(clock.currentTime),
dispEntity.properties.AL.getValue(clock.currentTime)
);
var radii=new Cesium.Cartesian3( // update the ellipsoid size
Math.round(dispEntity.properties.HAc.getValue(clock.currentTime)),
Math.round(dispEntity.properties.HAc.getValue(clock.currentTime)),
Math.round(dispEntity.properties.VAc.getValue(clock.currentTime))
);
AccurEntity.position=position;
AccurEntity.ellipsoid.radii=radii;
}