- Home /
Question by
felixpk · Aug 14, 2014 at 04:19 PM ·
particleshurikenbestpractices
New ParticleSystem LocalVelocity Like In Old ParticleSystem
Hello!
I started with a ParticleSystem (the old one), where I could change the localVelocity like this:
private ParticleEmitter pe;
pe.localVelocity = direction;
I just changed it to the new ParticleSystem, when I noticed there is no easy way of changing the localVelocity.
Any suggestions?
One more thing, I tried the following but it seems like the particles have no gravity
ParticleSystem.Particle[] p = new ParticleSystem.Particle[particleSystem.particleCount + 1];
int l = particleSystem.GetParticles(p);
int i = 0;
while(i < l) {
p[i].velocity = direction;
i++;
}
particleSystem.SetParticles(p, l);
They just come out of the ParticleEmitter and shoot right away above the target.
Felix
Comment
Best Answer
Answer by felixpk · Jul 19, 2016 at 04:22 PM
I just wanted to let you know how to access Properties in the new ParticleSystem:
private ParticleSystem.EmissionModule em;
private ParticleSystem.MinMaxCurve mmc;
void Awake() {
em = groundPraticles.emission;
}
void Update(){
mmc.constantMax = rb.velocity.magnitude; // For example velocity of RB
em.rate = mmc;
}
Just a basic example of setting the emissionRate Property of the new ParticleSystem.