Object Spawner
Properties
Layer Mask
LayerMask
The layer on which the raycast will be performed to find the anchor points for the paths
Number of Paths
uint
The number of paths that will be created from the initial point
Divergence
float [0;1]
Closer to 0 means that the angle between the path will be initially evenly distributed, closer to 1 makes it more random
Angle Range
float [0;360]
Defines the portion of the initial circle that will be used to create the paths.
Iteration Angle Divergence
float [0;360]
Defines the maximum angle between two steps of a path
Are Paths Sorted
boolean
Defines if the paths should be used in the geometrical order or if they should be randomly shuffled
Spawnables
Spawnables
Random Spawn Delay
float > 0 (seconds)
The objects will spawn between a delay of 0 and this value
Note
The length of the paths is not defined here, but in the subclasses. This is because the length of the paths is implicit for the static object spawner, but explicit for the dynamic one.
Examples
Let's take an initial set of properties and construct paths on a flat surface to make the visualization easy. Then, let's tweak them one by one to see how the paths are affected by these properties. For the sake of this example, we consider paths of length 3. This means that each path is constituted of 3 anchor points, or 2 segments.
Considering these properties:
Layer Mask : Default
Number of Paths : 10
Divergence : 0
Angle Range: 360
Iteration Angle Divergence : 0
Are Paths Sorted : True
And these that will only be used in the end of the page:
Spawnables : Ant.Prefab
Random Spawn Delay : 3
We can obtain such paths which go in a straight line, they are equally distributed around the full circle of the initial point:
Now let's bump up the number of paths to 15, as expected we just have 15 paths instead of 10:
Now let's dive into the more mysterious parameters. While keeping all previous parameters, we can increase the divergence to 1. As you can see, the paths are no longer equally distributed. The closer we get to 0, the closer we are from the previous picture, and the closer to 1 to more random it gets.
Let's still keep other parameters as they were, but change the angle range to 120 degrees. We still have 15 straight paths that are build but they are now closer to each other as only a third of the circle around the initial point is used. We can still see that the divergence is 1 because the angle between them is not the same. This is how it looks like
Now, a very key parameter that is going to go away from these straight lines and have random little paths: Iteration Angle Divergence. For each iteration on the path, we allow to diverge from the straight line of an angle from 0 to the value of Iteration Angle Divergence. If we set it to 15 while keeping the same parameters from before, this is what we get:
Finally, some procedural looking stuff! Each segment is constituted of 3 anchor points, and they all share the initial point as the first anchor point. We can then play around with the parameters and look at it on a 3D environment, and obtain results such as this:
It is pretty much the same as what we've seen before, but with longer paths (20 anchor points) and wrapped around 3D colliders.
Finally, the last parameter Are Paths Sorted will determine, in the process of the effects you create, if the paths should be used in the natural geometrical order, or randomly. I am aware that "natural geometrical order" is an expression I made up, so here is an example with ants to understand better.
In this example the ants are spawned with the Random Spawn Delay set to 3 seconds, and then enjoy their lives along the paths. When the paths are sorted, we give the first ant to spawn the first path, the second ant the second path etc. In the other scenario, we just give them a random path.
With Are Paths Sorted = true:
With Are Paths Sorted = false:
Last updated