All instance geometries must have an indices or not have one. Error When animating >1 Sphere Entity

1. A concise explanation of the problem you’re experiencing.

When animating more than one spheres (in wireframe like outlook -u sing a timer to draw increasingly the number of Sphere.ellipsoid.stackPartitions as explained below) I am encountering the following error:

  • All instance geometries must have an indices or not have one. and my cesium world crashes

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

The crash with error : All instance geometries must have an indices or not have one will occur once I start the timer to start animating more than 1 spheres via the following sniplet:

  • Calling the below code once is ok … sphere will animate with no crash or error. Once the second sphere created and start animating… it crashes with the error above.

function StartAlertSphereAnimation(alertID)
{
var alertSphereSet = alertEntityDump[alertID];

    if(alertSphereSet != undefined)
    {
        jsLogger.debug("Starting Alert Sphere Interval:");
        jsLogger.debug(alertSphereSet);

        alertSphereSet.D2.animateSphereHandle = setInterval(function()
        {                                              
              AnimateAlertSphereShrink(alertSphereSet.D2);      // For 2D                                                
        }, 300);           
           
       
        alertSphereSet.D3.animateSphere3DHandle = setInterval(function()
        {
              AnimateAlertSphereExpand(alertSphereSet.D3);     // For 3D                                                                                              
        }, 300);

jsLogger.debug(“Alert Sphere Started Interval”);
}
};

function AnimateAlertSphereShrink(alertSphere)
{
if(alertSphere != undefined)
{
if(alertSphere.ellipsoid.stackPartitions != 1)
{
alertSphere.ellipsoid.stackPartitions -= 1

// jsLogger.debug(“Added Stack for Sphere :” + alertSphere.ellipsoid.stackPartitions);
}

else
{
alertSphere.ellipsoid.stackPartitions = 10
// jsLogger.debug(“Sphere Reset :” + alertSphere.ellipsoid.stackPartitions);
}
}
};

function AnimateAlertSphereExpand(alertSphere)
{
if(alertSphere != undefined)
{
if(alertSphere.ellipsoid.stackPartitions != 10)
{
alertSphere.ellipsoid.stackPartitions += 1

// jsLogger.debug(“Added Stack for Sphere :” + alertSphere.ellipsoid.stackPartitions);
}

else
{
alertSphere.ellipsoid.stackPartitions = 1
// jsLogger.debug(“Sphere Reset :” + alertSphere.ellipsoid.stackPartitions);
}
}
};

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

Hi guys I am trying to create multiple animated ripple Alert effect on both 2D and 3D map (thou 3D looks more like a semi-dome) . I am trying to achieve this effect by using a timer to draw increasingly the number of Sphere.ellipsoid.stackPartitions (looks like the Wireframe of a sphere but in top-down view u should see a growing circle like a ripple effect to alert a certain location)

Btw if anyone has a better way in Cesium to recreate a ripple alert wave form please do enlighten me. Thanks

4. The Cesium version you’re using, your operating system and browser.

current cesium version is 1.52

Browser : Chrome (running in application mode)

OS: Windows 10

Appreciate anyone in advance for the help.

JohnT

Can you post a Sandcastle example (https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/) that I can run to see this crash? That’ll help me debug this and figure out if it’s a bug or not.

Sorry can I know how to post a sandcastle example? anyway I basically made the sphere unfilled and played with the sphere.ellipsoid.stackPartitions counter as shown in my sniplet. using timer to trigger the changes.
it will give an error when u repeat this with the second sphere.

If you go to https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/ you can write your code and run it there, and then you can click “Share” at the top and copy and paste the link you get from there here.

I’ve modified the Ellipsoid example to animate the stackPartitions using a callback property. Here’s a running example.