How to get the children Entities by Parent entity in cesium js ?

is there any method or way to get the children entities by parent entity.

This is sample code:

var boxes = entities.add(new Cesium.Entity());
var spheres = entities.add(new Cesium.Entity());

for (var i = 0; i < 5; ++i) {
    var height = 100000.0 + (200000.0 * i);
        id:"boxes_" + i.toString(),
        parent : boxes,
        position : Cesium.Cartesian3.fromDegrees(-106.0, 45.0, height),
        box : {
            dimensions : new Cesium.Cartesian3(90000.0, 90000.0, 90000.0),
            material : Cesium.Color.fromRandom({alpha : 1.0})

        parent : spheres,
        position : Cesium.Cartesian3.fromDegrees(-98.0, 45.0, height),
        ellipsoid : {
            radii : new Cesium.Cartesian3(67500.0, 67500.0, 67500.0),
            material : Cesium.Color.fromRandom({alpha : 1.0})

so in above i am putting the boxes and spheres in seperate parent entity, than i loop through upto parent entity children length.

so, how i get the length and the children entity.

right now i am using this weird things i.e is private variables in cesium.

var entityName = spheres._children[0].id;
var sphereLength = spheres._children.length;

so is there any way help me out.


Sorry, there doesn’t seem to be a public variable for accessing the entity children. Why do you need to access the child entities?



Thanks for reply Hannah,

i need it becoz i separated the all entities by there respective parents. so, i don't want to loop through all the entities collection and put the new position and orientation to the model entity for animation, its continuous interval of 1 seconds.

As per performance manner this take at least less than a 1 second.

so i want a length and children entity by their parent. so, i able to loop through only the parent length and get entities by parent.