Grid Spawner
Overview
The Grid Spawner offers to spawn prefabs in a grid.
Detailed Explanation
The Grid Spawner is a powerful spawner that allows spawning objects in a grid with additional customization. We can choose where to spawn objects using the permitted area threshold, or add randomness to the transform of the spawned prefab. The difference between using this node and a Pose Set Spawner with the Grid Poses node is, that this node can perform some optimizations. This makes it the better choice when the objects are spawned in a grid and other pose based features are not needed.
Parameters
Inputs
Name | Type | Description |
---|---|---|
Heightmap | Map | Provides the heights for the spawned prefabs. |
Permitted Area | Map | Provides the values for the permitted area threshold. |
Controls
Name | Type | Description |
---|---|---|
Extents | float | The extents of the square region around the player in which objects will be spawned. |
Permitted Area Threshold | float | Spawn positions will be discarded if the value in the permitted area map is below this threshold. |
Grid Cell Size | float | The size of the individual square cells inside the Extents. |
Prefab | GameObject | The prefab that will be spawned at the input poses. |
Jittering | bool | Add jittering to the spawn position to break the pattern. |
Scale | Interval | Set the scale of the spawned object to a random value inside the interval. |
Translate Y | Interval | Additionally translate the spawned object with a random value inside the interval along the Y axis. |
Rotate X | Interval | Rotate the spawned object with a random value inside the interval around the X axis. |
Rotate Y | Interval | Rotate the spawned object with a random value inside the interval around the Y axis. |
Rotate Z | Interval | Rotate the spawned object with a random value inside the interval around the Z axis. |
Use Cases
Spawning with permitted area and a heightmap
This spawner will set the positions of the spawned prefab to the height of the Perlin noise. Since we use the permitted area feature we only allow objects to be spawned inside the area of real world buildings.
Further Reading
- Learn how spawners can pass data to prefabs.