Hey everybody,
so I try to create a menger sponge where each time I click a new level of cubes get added.
But I struggle with the layering of the repeats. I tried foreach before but that didn’t get me close to.
I kind of want a spread in the beginning and everytime I click new elements get added to the spread.
Send the spread of objects at the very top into the pad and assign the link going into that pad to Create. This will make sure that the pad will hold a pre-defined set of objects and you can manipulate that freely afterwards on Update.
There is an example about that in VL.TheBigBang in chapter 25 (Managing Spreads).
Thanks for the response.
But I am more curious about how to pass the spread through all the for each/repeats then add por iterated step an object to the spread from outside and then pass them out again.
Similar to this pseudo code
var boxes = [];
generate(){
var genBoxes = []
for (var x = -1; x < 2; x++) {
for (var y = -1; y < 2; y++) {
for (var z = -1; z < 2; z++) {
var b = new Box(x y,z);
genBoxes .push(b);
}
}
}
}
return boxes;
}
for (var i = 0; i < boxes.length; i++) {
var b = boxes[i];
var newBoxes = b.generate();
next = next.concat(newBoxes);
}
boxes = next
So for each existing box in the spread, i want to add boxes and these boxes need to get added again to the spread.