How to apply Particle System shape to velocity when emitting from script

using: Unity 2018.4.3f1

When I emit from a script, the particles do not have an velocity. The documentation says “Setting properties in the emitParams will override those properties in the emitted particles. Any properties not modified will inherit the behavior specified in the inspector.”
If i set the velocity in the emiteParams, all particles have the same velocity. I want random velocities that usually come from the shape module.

heres my code:

            EmitParams.position = arg2.ContactEventArg.Position;
            //EmitParams.velocity = (Vector2.up + Rando.OnUnitCircle()).normalized * ParticleStartSpeed;
           
            HitParticle.Emit(EmitParams,
                ParticleCount);

thanks,

If you are just setting the position via the EmitParams and want the everything else the same, have you tried simply moving the particle system where you want it, then call Emit(count)?

To do that you will need to also set the simulation space to World, otherwise all other particles will move too.

Thanks! that seems like a solution :slight_smile:

1 Like

Oh yes, and make sure the particle system is not emitting over time or emitting over distance, because in those cases you might get streaks of midair particles between the position the particle system WAS at and the new position.