| Item | Quantity | Price |
|---|
| Your cart is empty. Check out our collection of 3d models! |
Prices in:
Clear Cart
Home » Forums » Maya Boards » Dynamics & Effects » Birth percentage per instanced objects Topic 23 of 4024
| Item | Quantity | Price |
|---|
| Total | $0.00 (USD) | ||
| Your cart is empty. Check out our collection of 3d models! | |||
Prices in:
Clear Cart
| Name | Downloads |
|---|---|
TrueGlass |
845,848 |
detachSeparate.mel |
837,131 |
The Andy Rig |
617,678 |
Sergio |
467,158 |
LWOImpR4-R5_043 |
431,545 |
Tiny |
339,502 |
Smedge .6 |
208,192 |
Ocean Shader |
183,736 |
silver shader |
179,839 |
At The Sea |
163,200 |
| Name | Contributions | Posts |
|---|---|---|
| humster3d | 2152 | 2 |
| squir | 1303 | 0 |
| Pupuhol | 967 | 0 |
| KanhtArt | 857 | 0 |
| GuamWork | 854 | 0 |
| admin | 778 | 21231 |
| rose studio | 655 | 0 |
| stefano tartarotti | 616 | 0 |
| VKModels | 445 | 1 |
| fileadmin | 424 | 0 |
So I've got a particle system with 6 instanced objects on my index. All that works fine. Ideally, I'd like to set a percentage per each indexed object as they're born randomly. For example:
Index_obj1=90%
Index_obj2=2%
Index_obj3=2%
Index_obj4=2%
Index_obj5=2%
Index_obj6=2%
My brain is not working this morning, so any help would be appreciated.
I figured it out. Here's what I did for my example:
What I did is created 3 objects, identified as 0-2 (in the instancer node, the number to the objects left is it's index ID). In the particle system, I created a dynamic Attribute > General > Particle > userScalar1PP. I then created a creation expression as seen bellow:
$randInstFloat = rand(0,20);
int $randInst = $randInstFloat;
print ($randInst + "\n");
if ($randInst > 2)
{
nParticleShape1.userScalar1PP = 0 ;
}else if($randInst == 1)
{
nParticleShape1.userScalar1PP = 1 ;
}else if($randInst == 2)
{
nParticleShape1.userScalar1PP = 2 ;
}
Notes: rand creates float values, and the if = requires to hit an integer to match, so I converted the float to an integer. That said, the chances of hitting exactly 20 is very slim, though all other numbers are rounded down and have an equal chance of hitting. For this reason, I reordered the if statements so 1 and 2 created the uncommon objects and the rest created the common object.