Entities.getChildrenIDs Example


#1
(function()
{ 
    this.clickDownOnEntity = function(entityID, mouseEvent) 
    {     
        Ent = entityID;

        var copyEnt = Entities.getEntityProperties(Ent, ["rotation","position"]);
        var jsonEnt = JSON.stringify(copyEnt);        
        var data = JSON.parse(jsonEnt);
        var foundEntitiesArray = Entities.getChildrenIDs(Ent) ;
        
        print("found this many entities: "+ foundEntitiesArray.length);
        
        for (var i = 0; i < foundEntitiesArray.length; i++) 
        {
            var copyEntFind = Entities.getEntityProperties(foundEntitiesArray[i]);
            var jsonEntFind = JSON.stringify(copyEntFind);
            var dataFind = JSON.parse(jsonEntFind);            
            print(dataFind.name+" - "+dataFind.id);
        }        
    }
    
    var Ent;
}
)