PDA

View Full Version : particle runtime expression


zachgrachan
09-13-2003, 10:49 PM
any body know how to make a runtime expression that only goes every so many frames? for instance, say you wanted the radius of your "spheres" particles to change randomly every 10 frames - seems to me that

if (time % 10 != 0)
particleShape1.radiusPP=rand (.5, 1);


should work, but it still changes every frame. if I change the != to ==, I get no changes at all.

any ideas?

*edit*
I realised that Maya wasn't chopping the decimal like c++ does, so I changed it to :

int $isTenth = frame % 10;
if (abs($isTenth) <= .49)
{
particleShape1.radiusPP=rand(.5,1);
print("Remainder is: " + time % 10 + "\n");
}

galactor
09-14-2003, 09:10 PM
Your expression won't work because time/10 will never have ZERO as a remainder. If you said if (time % 24 != 0) Then it will do a new action each second.


:: Galactor ::

Concept4
09-18-2003, 06:22 AM
Time is a fraction of frames / framerate. You'll want to perform modulus on time with however many seconds you need between execution of code.

if ( time % 1 == 0 ) print ("Second : " + time);

If you wanted to do something every several frames just use the "frame" keyword instead.

if ( frame % 5 == 0 ){}

This will execute anything inside the {} every 5 frames.

Hope it works for ya

--Ronnie

zachgrachan
09-18-2003, 07:15 AM
doh! that is better, can't believe I didn't think of it now that I see it...

CGTalk Moderation
01-16-2006, 04:00 AM
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.