PDA

View Full Version : query particle age when speed==0?


ftaswin
06-10-2008, 12:23 AM
Hi,

Can anyone tell me how to query a particle's age when the speed is 0? I wanna make some growing plants with instancer and I want it to start growing when it hits the ground (speed=0)


Thank you

Ft

ashishdantu
06-10-2008, 05:18 AM
hi,

just off my head... what do you get when u use:

if (speed==0)
float $currAge = age;


i guess if you just get the age, its actually the Current age at the current frame ?

am interested to find out what and how you plan to spawn the tree upon particle collision ?

MikeRhone
06-10-2008, 05:51 AM
I don't think there is actually a 'speed' attribute on particles. To get that you need to use

mag(velocity);

To print the age of the particle when its speed is 0, you could do this

$speed = mag(velocity);
if ($speed ==0)

{
$age = particleShape1.age;
print $age;
}

Aikiman
06-10-2008, 06:53 AM
Another way would be to use a collision event, emit another particle shape.

ftaswin
06-12-2008, 08:21 AM
Thanks, all...

I already have my trees growing as I wanted I just need more control and specific. What I did was I controlled the object index of my instancer to run only when the particle hits the ground (speed==0) and when I used smoothstep(0,lifespanPP*01, age) to control how fast my tree is growing to full shape instead of 0 if I can get the age when my particle hits the ground it's even more precise


Ft

ftaswin
06-13-2008, 06:12 AM
mayday mayday...

I need to query the age only once first time the particle speed is 0.

The lines above query the age every frame. Heeelp...... Thanks

Aikiman
06-13-2008, 06:47 AM
Just create an empty event in the collisions event manager and query if event is greater than 0 then do something.

ftaswin
06-13-2008, 07:20 AM
Thanks Jeremy,

I've managed to tackle it with assigning an empty initialAge and modify it in runtime expression....

Thanks everyone for helping...

Ft

CGTalk Moderation
06-13-2008, 07:20 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.