Dynamic Object Spawner
Last updated
Last updated
If you haven't read
yet, please do it and then come back here.
The goal of this effect is to use the paths to create some dynamic effects. It instantiates objects at the initial point, these objects can be anything but in the example I created I chose ants and fog particles. Then each of these object is going to spawn after a random delay, and then travel along one of the path at a given speed, for a given lifetime.
The paths are created on the go so they will adapt to moving colliders, as long as the relative speed between the objects and the colliders is not too big, then weird behaviors could occur. You can diminish that by having a higher Objects Speed value or a smaller Preferred Step Distance
Preferred Step Distance
float >= 0.01
The distance between each anchor point of the path, can differ from it if it is impossible to find an anchor point in that range
Objects Lifetime
float >= 0
The time in seconds before the object gets destroyed after they spawned
Objects Speed
float >= 0
The speed (arbitrary unit) at which the objects travel along the paths
Destroy Duration
float >= 0
The time taken for the object to scale down to 0 before getting destroyed
Let's illustrate what the non obvious parameters do when we tweak them. For that let's use a dynamic object spawner that spawns ants (yes, more ants).
Let's compare a Preferred Step Distance of 1 with a Preferred Step Distance of 0.5. As you can see in the following picture, the paths that are created with a bigger step distance will be more jagged, whereas the ones with a smaller step distance look more continuous. But in both scenario, the ants will travel at the same speed and live for the same lifetime.