Chunks birth script : how to create chunks every nth frame

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 04 April 2008   #1
Chunks birth script : how to create chunks every nth frame

This is my first attempt at scripting particles so please excuse my confusion.

How do I adapt the chunk script (below) so that instead of creating all the particles at frame 0 (t<0), the particles are birthed every nth frame.

I assume I need to change the "if t < 0 do" to something like "for t=0 to numChunks by x" where x is the number of frames I want between each particle being birthed. Or am I, as I suspect, barking up the wrong tree?

Code:
on ChannelsUsed pCont do ( pCont.useTime = true --enable the Time channel pCont.useAge = true pCont.useTM = true pCont.useShape = true ) on Init pCont do ( global ChunksArray = $parts* as array ) on Proceed pCont do ( t = pCont.getTimeStart() as float if t < 0 do ( NumChunks = ChunksArray.count for i = 1 to NumChunks do ( pCont.AddParticle() pCont.particleIndex = pCont.NumParticles() pCont.particleAge = 0 pCont.particleTM = ChunksArray[i].transform pCont.particleShape = ChunksArray[i].mesh ) ) ) on Release pCont do ( )
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max
 
Old 04 April 2008   #2
Ok, managed to suss it out.


Code:
on ChannelsUsed pCont do ( pCont.useTime = true --enable the Time channel pCont.useAge = true pCont.useTM = true pCont.useShape = true ) on Init pCont do ( global ChunksArray = $parts* as array ) on Proceed pCont do ( t = pCont.getTimeStart() as float if t > 0 do ( NumChunks = ChunksArray.count tt = ((t/160)+1) pCont.AddParticle() pCont.particleIndex = pCont.NumParticles() pCont.particleAge = 0 pCont.particleTM = ChunksArray[tt].transform pCont.particleShape = ChunksArray[tt].mesh --pCont.particleOrientation = [0,0,0] pCont.particleOrientation += [90,0,0] ) ) on Release pCont do ( )
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max
 
Old 05 May 2008   #3
Thumbs up

Thanks for posting the code.

Much appreciated.
__________________
WilliamRickert.com
 
Old 05 May 2008   #4
Be warned... my code is crap. I think it causes the script to crash when you run out of chunks to create particles from... ie when you scrub the timeline past the birth of the last particle. It works, but not very cleanly.
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max
 
Old 05 May 2008   #5
That's fairly common and I wouldn't worry about if it's a one use deal. If you're going to do alot of this you'll want to bake the particle animation. Then you can scrub to your heart's content.
__________________
WilliamRickert.com
 
Old 05 May 2008   #6
Thread automatically closed

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.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:09 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.