I found a bug----- About adding Rectangle

There are two ways to add a Rectangle to cesium:
   one:
         var greenRectangle = viewer.entities.add({
            rectangle : {
                coordinates :rectangle,
                material : Cesium.Color.GREEN.withAlpha(0.5),
                height : 300,

            }
        });
There is no problem with this method;

two:
But the following way there is a problem:
var RectangleGeometry = new Cesium.RectangleGeometry({
       rectangle: rectangle,
       height:300
});
    console.log("++++++++++++++++++++++");
    console.log(RectangleGeometry)
    console.log(RectangleGeometry instanceof Cesium.RectangleGeometry);
var GeometryInstance = new Cesium.GeometryInstance({
        geometry:RectangleGeometry,
       attributes:{
              color : new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 0.0, 0.5)
            }
});
var primity = viewer.scene.primitives.add(new Cesium.GroundPrimitive({
       geometryInstances : [GeometryInstance]
}));

in RectangleGeometry = new Cesium.RectangleGeometry({
       rectangle: rectangle,
       height:300
});
Here, when set high, the height of the Earth's surface in the Rectangle does not change

I want to know where I am wrong, or that he really is a bug

Hi there,

The first method uses the Entity API. It’s higher level, and will update the geometries based on changes you make to the entities.

The second uses the Primitive API. It’s lower level, and is directed at developers who want much finer control. It will not automatically update when changes happen.

I’m not sure what you mean by “the height of the Earth’s surface in the Rectangle does not change”. Can you create a Sandcastle example showing the problem?

Thanks,

Gabby