tyFlow Forum
Shape distribution controlling exact number of shapes in a system - Printable Version

+- tyFlow Forum (https://forum.tyflow.com)
+-- Forum: tyFlow Discussion (https://forum.tyflow.com/forum-1.html)
+--- Forum: General Discussion (https://forum.tyflow.com/forum-2.html)
+--- Thread: Shape distribution controlling exact number of shapes in a system (/thread-3987.html)



Shape distribution controlling exact number of shapes in a system - Sputnikanimation - 11-21-2023

Hello,   

 I'm trying to distribute 2 different particle shapes/color in a system, but I need to control the exact number of each particle shape/color and still randomly distribute them in the target volume.  I need to be able to adjust the numbers of each shape for different variations of the animation. For simplicity - it's like I have 2 colors of gumballs in a bowl. I need to have 22 red gumballs and 35 Blue gumballs all mixed up together randomly.  
  Right now I'm using the random by frequency method, but that works by percentage so even if I try to set up a system with 50% of each color I'm not sure if I would get 22 red and 22 blue gumballs in a 44 particle system. 

  I'm new to using an index from custom float variables or channel data but it seems like this is where I could control the distribution better. Is there a good tutorial on how to use this index and how I might be able to set up variables to have the system distribute an exact number of one color gumball and another exact number of the other color gumball?  

  The other challenge with this system is that I want to set up an interparticle collision test that would detect if two different colored gumballs have collided then randomly and based on a percentage chance cause the gumballs to swap colors briefly then switch back to their original colors. But this only happens on a rare chance.   

  Thank you for your help,  

 James


RE: Shape distribution controlling exact number of shapes in a system - tyFlow - 11-22-2023

Why not have 2 separate Birth operators for each type of particle, and just specify how many you need...then send the particles to the same event for the simulation itself.


RE: Shape distribution controlling exact number of shapes in a system - Sputnikanimation - 11-22-2023

OMG - sometimes I get stuck looking at a complicated solution to an issue I don't even consider the simple approach. Thanks for helping me get my brain unstuck. Smile