Page 1 of 1
Daemon affect, based on particle age
Posted: Tue Nov 05, 2013 8:57 am
by DeltaJuliet
Hi,
Is it possible for a daemon to affect a particle based on its age?
eg - as each particle gets older, drag will increase to a predefined max.
cheers
Dave.
Re: Daemon affect, based on particle age
Posted: Tue Nov 05, 2013 9:21 am
by tsn
Create a scripted daemon, open it with "Edit", look for "def applyForceToEmitter( emitter ):" and replace it (including the pass statement) with this piece of code:
Code: Select all
def applyForceToEmitter( emitter ):
particle = emitter.getFirstParticle()
dragX = 1.0
dragY = 1.0
dragZ = 1.0
dragThres = 5.0
while particle:
pVel = particle.getVelocity()
pAge = particle.getAge()
forceX = -1 * (dragX * pVel.x * pAge)
forceY = -1 * (dragY * pVel.y * pAge)
forceZ = -1 * (dragZ * pVel.z * pAge)
drag = Vector.new(forceX,forceY,forceZ)
if (drag.module() <= dragThres):
particle.setExternalForce( drag )
particle = particle.getNextParticle()
Mind the indents! The script is based on this resource:
http://www.realflow.com/resources/item/ ... ch/58/drag
Re: Daemon affect, based on particle age
Posted: Tue Nov 05, 2013 9:26 am
by DeltaJuliet
Wow, fastest reply ever!
thankyou very much.
cheers.
Dave.