Download

Spawn trees

We need to create a construction script that will loop through a set of points in the scene and place a tree at each point.

We are importing a model via obj which includes a set of points where trees should be located. But we really don’t want to manually have to click on each point. If we could automate it with a construction script, that would be great.

Any suggestions? Are there any examples that show something similar?

You could knock up something basic.

Use create transform node for each point you want to spawn a tree .
Then use branches or loops and spawn actor at location. Using the transforms you made earlier as the transform location on the nodes for the trees location you wish to spawn.

Another tip is to spawn static instance meshes of the trees for performance and only change them back to dynamic meshes if you need to interact with them .

Another possible thing to look at is the experimental procedural foliage tool. But I’m not sure if this only works in the editor or if you can spawn this at runtime. Interesting though you can actually make a blueprint of the foliage spawner as a parent so it might be possible to create a blueprint using this that you can tweak but I havnt had a chance to test anythin yet

Thanks for the reply. I was trying something like you suggested, but how do I loop through the points?

Have all the points in an array of vectors then just do a for each loop.