Rectangle following a flight tracker

Hi all.
I’m new in Cesium and in JS.
Is there a way to draw a rectangle following a flight tracker that uses a 3D model?

Thanks

Hi! You can use a rectangle entity and change its position based on the position of the 3D model. Here is an example using a path entity instead, but the rectangle entity would have a similar concept: Sandcastle. Note that path in the example has multiple points for positions, but a rectangle only has one position.

Hi!
Thanks for your help.
I share my code to help others beginners:

async function loadModel() {
// Load the glTF model from Cesium ion.
const airplaneUri = await Cesium.IonResource.fromAssetId(284344);
for (let i = 0; i < positionProperties.length; i++) {
viewer.entities.add({
description: Fly: ${fligthsIdentifiers[i]},
availability: new Cesium.TimeIntervalCollection([
new Cesium.TimeInterval({ start: start, stop: stop }),
]),
position: positionProperties[i],
model: {
uri: airplaneUri,
minimumPixelSize: 68,
maximumScale: 10,
color: Cesium.Color.RED,
},
// Automatically compute the orientation from the position.
orientation: new Cesium.VelocityOrientationProperty(
positionProperties[i]
),
path: new Cesium.PathGraphics({
width: 3,
material: Cesium.Color.YELLOW,
leadTime: 20,
trailTime: 0,
}),
});

          viewer.entities.add({
            position: positionProperties[i],
            point: {
              color: Cesium.Color.ALICEBLUE,
              pixelSize: 20,
              outlineColor: Cesium.Color.RED,
              outlineWidth: 1,
            },
          });

          //viewer.trackedEntity = airplaneEntity1;
          viewer.camera.flyTo({
            destination: Cesium.Cartesian3.fromDegrees(
              1.898602,
              41.504895,
              5000.0
            ),
            orientation: {
              heading: Cesium.Math.toRadians(90.0),
              pitch: Cesium.Math.toRadians(-90.0),
              roll: 0.0,
            },
          });

               }
      }

1 Like