- Home /
Question by
Mikedegianthobbit · Apr 07 at 10:53 PM ·
rotationrandomparticle systemshapeparticle emitter
Randomize shape.rotation for a particle emitter shape, sub emitter instance
Hi All, I'm making a firework that has a ring-like burst effect that goes off on death of the emitting particle.
The problem is, the sub emitter shape is in the same orientation every time. There are multiple of these ring-like bursts happening at the same time.
Is there any way to randomize the shape.rotation of the ring emitter shape for each instance of the ring-like sub emitter?
Thanks!
ringbursts.png
(123.7 kB)
Comment
Answer by Mikedegianthobbit · Apr 07 at 10:58 PM
If there isn't a solution maybe it would be doable for unity developers to add "random between two constants" as an option for the rotation here?
shape-module.png
(15.3 kB)
Partial solution is to attach this script to the sub emitter but it only works if the sub-emitter instances spawn at different times
void Start()
{
self = GetComponent<ParticleSystem>();
PSShape = self.shape;
}
void Update()
{
if (self.particleCount > _count)
{
rotation = new Vector3(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360));
PSShape.rotation = rotation;
}
_count = self.particleCount;
}