Procedurally place actors over a landscape

One of the functions proposed by the Landscape Generator is the procedural placement of actors over the landscape. Using the procedural actor spawning allow us to place complex objects over the landscapes, like particle emitters, sound emitters, or complex meshes.

As the actors are not managed like the foliages, the process of generating and spawning actors is managed differently. Let’s quickly see the principles of the procedural actor spawning.

Generate a water plane.

A water plane is a particuliar actor. It has its own generation function which is really simple to use.

The parameters of this function are:

Generate any kind of actors.

The generation of actors is splitted in two steps (like the foliages): generation and spawning. Let’s focus first on generation.

Generate Actors

The function generate actors is Generate Actors. Its purpose is to place objects over a landscape, like the Generate Objects of foliages. However, it doesn’t spawn them.

As we can see, there are lot of parameters. First let’s focus on the Generate Actors parameters:

Note that once the actors are generated, they are not spawned yet. So it’s totally possible to manually edit these elements before spawning them. For instance, the Class parameter is used to specify the class of the actors generated by the Generate Actors function.

Details about ActorElement

One of the key point of the Generate Actors function is the parameter template. It describes the parameter of the actors which are going to be generated. These parameters are the standard parameters for spawning actors, thus we can find the detailed documentation of each one of these parameters in the Unreal Engine documentation.

An important thing to note is that the Generate Actors function will take the Actor Element as a template to generate (and return) a lot of new Actor Element. These new elements will share the same parameters as their template, except for the location and the rotation.

As we can see, calling Get Elements on the result of this node will return an array of Actor Element. Before being spawned, these elements can be edited manually to change their location, or eventually other parameters like their class or their owner, allowing us to have a fine control on the actors we want to spawn.

Spawn Actors

Now that the positions of the actors are generated over the landscape, we can proceed to spawn the actors. This function takes as parameter the actor elements, and returns the spawned actors.