Jump to content
Sign in to follow this  
dagoose

selecting a random bunch of particles per frame

Recommended Posts

Hi,

It's driving me nuts ... sounds so simple but just can't get it to work.

Lets say I have an box which are emitted particles into. Now I define a pop group via a bounding and want to delete 25 particles every frame in the bounding.

Thanks for yout help.

delete_rand_particles_per_frame.hip

Share this post


Link to post
Share on other sites

Try using a PopKill instead of a PopWrangle. You can specify the group and use the Random tab to randomly remove some particle in the group.

 

Share this post


Link to post
Share on other sites

or if you still want to use wrangle, try with something like

float seed = @id + @Frame;
if (rand(seed) < 0.025) @dead = 1;

 

Edited by sasho78

Share this post


Link to post
Share on other sites
Quote

 

Thanks you guys!

I am guessing that the rand function is supposed to return an equal spread ... still it is very hard to control the amount of particles getting deleted.

 

Share this post


Link to post
Share on other sites

In cases when you need to randomly delete strictly a given number of elements, one way is to sort the elements randomly and then delete N first ones.

If you need to maintain the point order, you could probably sort a separate copy of the particles, select first N to a group and match that back to the originals according to id.

Or script it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×