Daemon affect, based on particle age

Post Reply
DeltaJuliet
Posts: 78
Joined: Thu May 30, 2013 1:19 pm

Daemon affect, based on particle age

Post by DeltaJuliet » Tue Nov 05, 2013 8:57 am

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.

User avatar
tsn
Posts: 283
Joined: Fri Jun 11, 2010 7:22 am

Re: Daemon affect, based on particle age

Post by tsn » Tue Nov 05, 2013 9:21 am

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
Thomas Schlick | Next Limit Technologies

DeltaJuliet
Posts: 78
Joined: Thu May 30, 2013 1:19 pm

Re: Daemon affect, based on particle age

Post by DeltaJuliet » Tue Nov 05, 2013 9:26 am

Wow, fastest reply ever! :D
thankyou very much.

cheers.

Dave.

Post Reply