Hello, everyone!
I have created a blueprint that adds meshes according to the position of a vector variable, very similar to the one in this tutorial:
I made some little alterations so that only the x-value matters at the moment and the meshes also get added correctly when the x-value is negative.
This works perfectly fine until here.
However, I wanted to add random meshes instead of just one.
So I changed the loop body to go into a branch first. A random float gets created and if it is <=0.3 one mesh gets added, if it is larger than 0.3 but not larger than 0.6 a different mesh is added instead. If that is also not the case another mesh is added.
However, this causes a very strange bug.
Some of the meshes are missing. No matter how far I move the EndPoint on the x-axis, the problem always seems to appear only in the first couple of meshes. However, they are not always the same ones.
I enabled Simulate Physics in the Add StaticMesh nodes to see if there are some overlapping meshes and it seems like the missing ones are always stacked on the very last one.
I might have some logic mistake in my blueprint but I just can’t figure it out. It’s just so weird that the problem only occures within the first few meshes. I even set the x-value of the EndPoint to 1 Million, adding 1000 Meshes. Still, there only were missing ones among the first few. When the x-value of the EndPoint is rather low there are 0-2 meshes missing but when the value is quite high they seem to be always exactly 2.
Also, my method of choosing between random meshes seems quite dirty. Is there a better way? For example using arrays or simply a node that randomly fires one of its outputs?
And one more question: Does the random float gets randomized both times it is used in my blueprint or only once per loop? Either way, I tried avoiding that by creating a variable that gets set to a random float every time the loop starts and then use the variable instead of the random float in the picture above. But the results were exactly the same.