misterius error on primitives.add() in batching

Hi,

I'm trying add a simple circle in the batching branch, and I seem to
encounter a mysterious error that can't really make sense of. this
makes the code break at primitives.add(), with no error report on the
console.

the code is the following:

        var scene = widget.cesiumWidget.scene;
        var primtivies = scene.getPrimitives();
        var ellipsoid = widget.cesiumWidget.centralBody.getEllipsoid();
           
        var material = Cesium.Material.fromType(scene.getContext(),
'Color');
        material.uniforms.color = new Cesium.Color(0, 0, 1, 1);
        var appearance = new Cesium.MaterialAppearance({ material:
material });
                               
            var item = items[i];
                                   
            var lonDeg = -74.9336013793945;
            var latDeg = 40.07080078125;
            var elevFt = 11;
            var id = 'foo'
       
            var center = new
Cesium.Cartographic(Cesium.Math.toRadians(lonDeg),
                                                
Cesium.Math.toRadians(latDeg),
                                                 0);
            var radius = 200 * 1000;
               
            var circle = new Cesium.CircleGeometry({
                                ellipsoid : ellipsoid,
                                center :
ellipsoid.cartographicToCartesian(center),
                                radius : radius,
                                height : 10 * elevFt / 3.2808399
                            });
            var circleInstance = new Cesium.GeometryInstance({
                                            geometry: circle,
                                            id: id
                                        });
            var primitive = new Cesium.Primitive({
                                    geometryInstances : [ circleInstance ],
                                    appearance : appearance,
                                    id : id
                                });
            console.log("yuyy");
            primitives.add(primitive);
            console.log("yayy");

now, while 'yuyy' is displayed, 'yayy' is not, there are no error
messages, and of course the circle in question is not drawn.

what am I doing wrong?

Akos

Hi Akos,

On the second line of code, you spelled ‘primitives’ wrong, so you never added it to the scene’s composite primitive.

Dan

indeed. oh, I was tired.

I'm sorry to have bothered you with such a silly mistake :frowning: