function randomProperites(){ var position = Vec3.sum(MyAvatar.position,{x:Math.random(),y:Math.random(), z:Math.random()}); var color = {red:Math.random()*200,green:Math.random()*100,blue:Math.random()*200}; var properties = { type: "Sphere", position: position, color: color }; //print("Created some random colors" + JSON.stringify(color) + "\n at some random location" + JSON.stringify(position)); return properties; } //Creates a bunch of entities for (i = 0; i < 20; i++){ Original = Entities.addEntity(randomProperites()); print("Created an entity with: " + JSON.stringify(Entities.getEntityProperties(Original).color)); } // find the closes one and make it white arrayFound = Entities.findEntities(MyAvatar.position, 100.0) print("Found some entities! These many: " + arrayFound.length); for( i = 0; i < arrayFound.length; i++){ Entities.editEntity(arrayFound[i], {color: {red:200, blue:200, green:200}}); Entities.editEntity(arrayFound[i], {shapeType: "Sphere"}); Entities.editEntity(arrayFound[i], {gravity : {"x":0,"y":-9,"z":0}}); Entities.editEntity(arrayFound[i], {dynamic : 1}); print("Turned a found entity to color: " + JSON.stringify(Entities.getEntityProperties(arrayFound[i]).color)); } // "shapeType": "compound",