View Full Version : Random particle test
Couch 06-11-2009, 12:50 AM Hi to all!!!
I need to select random particles and send them out to another operator...How this can be done?
|
|
JohnnyRandom
06-11-2009, 01:51 AM
A Script Test operator that sends out random particles based on particleID?
on Proceed pCont do
(
randomNum = pcont.rand0X 50
count = pCont.NumParticles()
for i in 1 to count do
(
--print randomNum
pCont.particleIndex = i
if pCont.particleID == randomNum then
(
pCont.particleTestStatus = true
pCont.particleTestTime = pCont.particleTime
)
)
)
Couch
06-11-2009, 02:04 AM
Thanks! This is what I need!
JohnnyRandom
06-11-2009, 02:32 AM
If you wish less particles to be tested true you can change the randomNum value
to something like:
randomNum = 3*pcont.rand0X 50
Just a note the number 50 is the upper limit of the random number, which is tied to the particles ID.
Couch
06-11-2009, 09:55 AM
I have problem with spawn (by travel) when I turn it on, the script random test gives only two particles and when I turn off spawn (by travel) it gives normal quantity of particles.
JohnnyRandom
06-11-2009, 04:38 PM
Placement of the test is somewhat important, since you are transferring particles to a new event by ID or index you need to figure out how many particles you will have in total at the end of your timeline.
This number should be set to the upper limit of the randomNum value (ie replace the 50 with the the variable count so it takes whatever the total number of particles is). So since you are creating new particles all the time the script test needs to be somewhere other than the event that holds the spawn operator so it has more particle ID's/index's to work with.
You could try something like this:
Max9_TestByRndNum.zip (http://www.4rand.com/TEST/ParticleFlow/Misc/TestByRndNum/Max9_TestByRndNum.zip)
on Proceed pCont do
(
count = pCont.NumParticles()
randomNum = pcont.rand0X (count/10)
for i in 1 to count do
(
--print randomNum
pCont.particleIndex = i
if pCont.particleIndex == randomNum then
(
pCont.particleTestStatus = true
pCont.particleTestTime = pCont.particleTime
)
)
)
http://www.4rand.com/TEST/ParticleFlow/Misc/TestByRndNum/TestByRndNum.gif
Couch
06-11-2009, 05:41 PM
Thank you very much!
CGTalk Moderation
06-11-2009, 05:41 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.