Hello! When I try to add 500 entities which has plane in it, while I customize dimensions property via CallbackProperty for smoothness of scaling, the FPS is very low. What could be the solution? My code:
const viewer = new Cesium.Viewer("cesiumContainer");
const newDimensions = new Cesium.Cartesian2(156000.0, 156100.0);
for (let i = 0; i < 500; i++) {
const latitude = (Math.random() * 180) - 90;
const longitude = (Math.random() * 360) - 180;
const height = Math.random() * 1000000;
viewer.entities.add({
name: `Entity ${i}`,
position: Cesium.Cartesian3.fromDegrees(longitude, latitude, height),
plane: {
plane: new Cesium.Plane(Cesium.Cartesian3.UNIT_Z, 0.0),
material: new Cesium.Color(1.0, 1.0, 1.0, 0.9),
dimensions: new Cesium.CallbackProperty(() => {
return newDimensions;
}, false)
}
});
}
viewer.scene.preRender.addEventListener(function () {
let cameraHeight = viewer.scene.camera.positionCartographic.height;
var newSize = 30000.0 * (cameraHeight / 2000000);
newSize = Math.max(newSize, 100.0);
let minHeight = 1000000;
let maxHeight = 20000000;
if (cameraHeight > minHeight && cameraHeight < maxHeight) {
newDimensions.x = newSize;
newDimensions.y = newSize;
}
});