Spawning Lights

One part of the tasting visualisation was to spawn lights around the main area.
For this I firstly spawned lights around the center.


However, these where only spawned in a square format and where not excluding the central area. Therefore the next step was to change the spawning in a circular shape, excluding the central area using a range of radius.


The next step was the correction of the y-axis to create more variation in height.

With this setup, however, it was quickly visible that the spawned objects where colliding with each other.

To solve this problem I created a sphere collider on the object. Switched it in the script and checked with Physics.OverlapSphere if the currently spawned object would collide with another object. If so I was decreasing my counter and in the loop instead of instantiating an object.

The next goal was to spawn the objects with a delay so they would appear after each other. To create this I used the Coroutine function in combination with a yield method to wait a few seconds before spawning this object.
After creating this delay I realised that the objects where spawned not across the whole radius but section per section following the cosine and sinus curves. To avoid spreading objects in one direction first and spreading then slowly in circle I increased the sinus and cosine count with the factor 15 to enable a faster spin and therefore a more even spawning.

In addition to this function I created an animation on the the object which did not affect the position. I worked with the scale of the objects so the objects had a slight movement to them and appeared and disappeared using the scale.