PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Drag

ParticleEmitter

float

The Drag property determines the rate in seconds at which individual particles will lose half their speed via exponential decay. Pictured below are two identical default ParticleEmitters, except that the right has a Drag value of 0.25.

Animation of drag on a ParticleEmitter

Drag is applied by scaling the expected velocity (from ParticleEmitter/Speed and any velocity inherited from the parent from ParticleEmitter/VelocityInheritance) by the following formula: 2 ^ (elapsedTime * -drag), where elapsedTime is the time since the particle was emit. Consequently, setting Drag to a negative value will cause particles’ velocities to grow exponentially.

Warning: if Drag is set to a sufficiently negative value, this can cause all particles emit by the emitter to completely disappear. Be careful when setting this property lower than -100.


Code Samples


Creating a Particle Emitter from Scratch

This rather lengthy code sample shows how every property of a ParticleEmitter can be set, including DataType/NumberRange, DataType/NumberSequence and DataType/ColorSequence properties. Below is how the ParticleEmitter should after every property is set. Try playing around with the different properties to customize how the effect looks!

The final product