Notifications
Clear all

[Closed] ParticleTestTime

Yes, I did search this forum first.

ParticleTestTime. I do not understand what this is.

I was making my first particle test script. Every script in the help I saw included it with ParticleTestStatus, but ignored to mention its purpose. I could not find its description plainly stated anywhere else in the Help file.

The code below is a simple integer test, which fails without the particle test time.


 on ChannelsUsed pCont do
 (
 	pCont.useInteger = true
 )
 
 on Init pCont do 
 (
 	
 )
 
 on Proceed pCont do 
 (
 count = pCont.NumParticles()
 	for i in 1 to count do
 	(
 		pCont.particleIndex = i
 		If pcont.ParticleInteger = 1 then
 		(
 			pCont.particleTestStatus = true
 			pContParticleTestTime = pCont.particletime
 		)
 			else
 		(
 			pCont.particleTestStatus = false
 		)
 	)
 )
 
 on Release pCont do 
 (
 
 )
 	
 
2 Replies

There were of course at least two typos in the code – the == after the IF was just =, and the particleTestTime was missing the period after the pCont.

But in general, when a particle tests true, the system also needs to know the exact time this happened.
By setting the particleTestTime to the particleTime, you are providing PFlow with the exact time stamp at which the test produced true. Keep in mind that depending on the Integration Step used, the operator could be evaluated several (or even hundreds of) times per frame, and it is important to mark the particle as not only passed the test, but with info about WHEN that happened with ticks precision.

You don’t use that info, PFlow needs it internally. Just set it and forget about it

Interesting, I looked again in the help file and could not locate where that was stated. That is going to make some changes in my code necessary. I was going to reset the particle time for a different test in the flow. I will have to try event age or particle age instead.