Copy by Matrix
CreatiCode last edited by creaticodeta2-mail
Sometimes we need to add a lot of copies of an object. Instead of making copies one by one, it’s much faster to use the “copying by matrix” block. The basic idea is to make copies of an object and place them to forum a 3D matrix,
Count in Each Dimension
These 3 numbers specify how many times this object will be repeated in each dimension. For example, in this program, the count is 5 for the X-dimension, 3 for the Y-dimension, and 2 for the Z-dimension.
we would get 5x3x2 = 30 objects arranged like this:
Note that if the count has to be at least 1 for every dimension, otherwise no copy will be made.
Spacing in Each Dimension
You can control the distance between the copies along each dimension. Note that it is not the size of the gap between the objects. For example, in the previous program, the spacing is 100 and the box size is 90, then the gap between them is 10.
It’s also possible to use a spacing value that is smaller than the size of the object. For example, in this program, the sphere size is 100 but the spacing between the spheres is only 60, so the spheres will cluster together.
Randomness in Spacing
To make the copies look more natural, we often need to vary their positions randomly. To do that, we can set the “random ratio in spacing”, which should be a number greater than or equal to 0.
Suppose the spacing in the X dimension is 200, and the random ratio is 50% in the X dimension, then the X-dimension distance between the copies will be a random value between 100 and 300. In other words, the distance can be at most 50% more than 200 or at least 50% less than 200.
As you can see, with some randomness, it’s very hard to tell these spheres are in a 3 by 3 by 3 matrix.
Randomness in Scale
Similarly, the copies can be randomly scaled larger or smaller. If the random ratio in scale is 30%, that means each copy can be up to 30% larger than the original object, or down to 30% smaller, or any size in between.
Randomness in Z-Rotation
You can also rotate the copies around the Z-axis randomly. For example, if the randomness
for Z-rotation is 100%, then each copy can be facing any direction between 0 and 360 degrees.
Exclusion Mode and Exclusion Object
The last 2 inputs allow us to remove some copies, so the remaining copies can form a more interesting shape.
For example, suppose we have one layer of 15 rows and 15 columns of spheres:
Suppose we also have a yellow sphere named “s” that covers some of the copies:
Now we can say don’t make any copies inside the yellow sphere. This can be done by choosing the only make copies “outside of s”:
Similarly, we can choose to only make copies inside the yellow sphere “s”:
All Copies Are Sharing the Same Data
To make the copying process fast, we are making all the copies share the same material, animation and parent as the original object. So if you update its color or animation, all copies will change the same way:
Original Object is Not at the Center!
It’s a common misunderstanding that the original object is at the center position among all the copies. In fact, the copies will have a larger X, Y or Z position compared to the original, because we are adding the spacing value for each new row, new column or new layer.
For example, if we are making a 3 by 3 by 3 matrix, the original is at the bottom left corner:
If you need to center the matrix of objects at the center of the scene, you need to shift the original object’s position before making the copies: