"Custom Chunks" with mesh update?!


#1

Hidiho!
I was wondering how can i create custom chunks with mesh update.
Indeed, the Custom Chunks script, available everywhere (like here: http://www.scriptspot.com/bobo/mxs5/pflow/pflow__Chunks_Basics.htm) allow just to use the mesh at frame 0 and never update it.
I “developped” a script based on the one upthere:

on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useAge = true
pCont.useTM = true
pCont.useShape = true
pCont.usePosition = true
pCont.useScale = true
pCont.useSpin = true
)

on Init pCont do
(
global ChunksArray = $blop* as array
)

on Proceed pCont do
(
t = pCont.getTimeStart() as float
v=(t/192)+1 – i don’t know why but that’s the only way for me
– to have the right number of the frame. Guess it’s a ticks thing.

     NumChunks = ChunksArray.count
     for i = 1 to NumChunks do
     (
         pCont.AddParticle()
         pCont.particleIndex = pCont.NumParticles()
         pCont.particleTM = ChunksArray[i].transform
         pCont.particleShape = at time v ChunksArray[i].mesh
         pCont.setParticleAge i v
     )

)

on Release pCont do
(
)

Works as hell as a birth script with a Delete By Age “1” operator right under it (if you don’t add this… well try it it’s pretty funny)
Anyway, with this script, when I send all this to another event, I don’t need to add another Delete by Age operator, and my particles age!
The problem is when i send to another operator, my mesh chunks stop to update.
So I add a script operator in the new event:


on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useSpeed = true
pCont.useAge= true
pCont.useTime= true
pCont.useShape= true
)

on Init pCont do
(
)

on Proceed pCont do
(
t = pCont.getTimeStart() as float
v=(t/192)+1

     NumChunks = ChunksArray.count
     for i = 1 to NumChunks do
     (

bb=(NumChunks-i)+1
pCont.particleShape = at time v ChunksArray[bb].mesh
print ChunksArray[bb]
print i
)
)

on Release pCont do
(
)

And that’s where the problem is: Only the last chunks update…!!!
I don’t understand… If you can help me works this out it will be great!
Cheers!


#2

Hi Mprodz,
Well meanwhile my post wasn’t published, I figured it out alone, like a one big boy
Just had to add this:
pCont.particleIndex = bb
in the Script Operator
So now the Script Operator looks like this:

on ChannelsUsed pCont do
(
pCont.useAge= true
pCont.useTime= true
pCont.useShape= true
pCont.useSpin=true
)

on Init pCont do
(
global ChunksArray = $blop* as array
)

on Proceed pCont do
(
t = pCont.getTimeStart() as float
v=(t/192)+1
NumChunks = ChunksArray.count

for i = 1 to NumChunks do
    (
    bb=(NumChunks-i)+1
    pCont.particleIndex = bb
    pCont.particleShape = at time v ChunksArray[bb].mesh
    )

)

on Release pCont do
(
)

And it works soooo fine,
May it helps you if needed.

Bye!


#3

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.