PDA

View Full Version : screwy particlePositon on event change


Britton
02-17-2010, 04:13 PM
Hey folks!
I'm writing a script to align an array of point helpers to particles over time using particlePosition. It goes a little something like this...

dummies = $Point* as array
part = $PF_Source

count = part.NumParticles()

animate on
(
for t in animationrange.start to animationrange.end do
(
slidertime = t

for i in 1 to count do
(
part.particleIndex = i
dummies[i].pos = part.particlePosition
)
)
)


anyway, it all works beautifully, until I start having flows with more than one event. For instance, if the flow goes through a collision or age test, the particleIndex seems to cycle through the particles while the test event is going on, meaning the animation of the dummies jumps around to different particles from frame to frame. After the test event is completed, things resume working properly. Weird, right? Anyone encountered this before?

thanks a bunch!

JohnnyRandom
02-17-2010, 04:27 PM
The Particle Index changes with every event. For example if you have 10 particles sent to a new event with an Age Test with variation, the first particle to enter the new event will be given an index of 0 (particle index is 0 based) and the next an index of 1 and so on.

If on the other hand if you use the Particle ID this will remain constant throughout all events. Take note the Particle ID is 1 based.

Britton
02-17-2010, 05:00 PM
that did it! I'd always figured particleIndex and ID were the same thing, guess I was wrong.

thanks a bunch!

CGTalk Moderation
02-17-2010, 05:00 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.