Hello,
I have a player object and I would like to spawn some prefabs around him (some orbs) while also doing in a manner where all orbs would be evenly spaced.
I can’t figure out how to evenly space them AND also be able to speed them up bit by bit, while I increase their count as well.
The idea would be to increase the overall rotation speed while I increase their count as well.
- the
holder.positionis aTransformI have to be the pivot for the rotation (linked to the player) fireballOffsetso that my orbs doesn’t spawn on top of the player but with a set distance from it
Here is the code I’m working with:
void Update()
{
timer -= Time.deltaTime;
if (timer < 0)
{
timer = timeBetweenSpawns;
if (objectSpawned < maxSpawnAmount)
{
objectSpawned++;
rot = (360f / maxSpawnAmount);
GameObject orb = Instantiate(fireballPrefab, holder.position + fireballOffset, Quaternion.Euler(0f, 1f, 0f), holder);
}
}
holder.rotation = Quaternion.Euler(0f, holder.rotation.eulerAngles.y + (rot * Time.deltaTime), 0f);
}