Page 1 of 1

Scripted deamon - particel.getTime() problem

Posted: Tue Jul 06, 2010 1:23 am
by starlighter
Hi,
i'm trying to write some simple deamon, but hit the wall with some problems. Seams that the script is ok, but something is not ok whenever i write down the function particle.getTime().
When the simulation starts, it point out to that line, telling me that something is wrong with that piece of code...

So if anyone has any idea what's wrong here, let me know please.
Here's the code

Code: Select all

#--------------------------------------------------
# Function: applyForceToEmitter 
# This function is called by the simulation engine 
# when external forces should be applied to the    
# particles in the emitter.                        
#--------------------------------------------------


def applyForceToEmitter( emitter ):
	import math
	particle = emitter.getFirstParticle()

	while particle:
		ptime = particle.getTime()
		up = Vector.new(0, math.atan(ptime*20-5)/15+0.1, 0)
		particle.setExternalForce( up )
		particle = particle.getNextParticle()



#--------------------------------------------------
thnx in advance!

Igor

Re: Scripted deamon - particel.getTime() problem

Posted: Tue Jul 06, 2010 7:08 am
by tsn
The getTime() function can only be used with keys. I think you're looking for the getAge() statement which is suited for particles.

Best,
Thomas

Re: Scripted deamon - particel.getTime() problem

Posted: Tue Jul 06, 2010 1:27 pm
by starlighter
Thx Thomas!
I was trying to replicate some function i got in expression, and thought that i could use getTime for that...
found another way although, but bumped into another problem... :) i'll post a question if i don't find a solution soon...