I’m trying to make a Blueprint that that will automatically generate a bunch of Instanced Static Meshes. I want to be able to pick a static mesh as a base and then have a bunch of Instanced Static Meshes spawn on it. Corals on top of a rock, in my case.
I made a struct that takes a Static Mesh
and a single float
value to be used as scale:
An array of these structs is used to spawn random Instanced Static Meshes. In the Construction Script I do the following:
- Get the bounding box of the base mesh (rock)
- Generate a bunch of random points in it
- For each of the points, start a line trace 200 units above the point, straight down
- Now I have a point on the rock where I can spawn something
- Pick a random struct from the list
- Add an Instanced Static Mesh with the Static Mesh of the struct
- Place it on the hit location of the ray
- Set the rotation based on the normal of the surface
- Set the scale to the value that was set in the struct
Here’s the problem that I’m having: everything works great when I add a single item to the list:
However, when I add more items, the scale value doesn’t seem to be respected. In this example I would expect the yellow corals to always have a scale value of 0.3
, while only the blue corals would have a scale value of 1
. As you can see in the picture, both the yellow and blue corals get a scale value of either 0.3
or 1
.
Does anyone have an idea why it’s picking both scale values for both items?