Changing Color on PhysX Interparticle Collision
#1
Hi All,

I feel like this should be simple, but I'm new to Tyflow and tend to get held up as I learn, so please bear with me Smile

I'm trying to change the material of a particle if it gets too close to another particle, then return to it's starting material when the neighboring particle leaves the radius.

I see there's a Property Test type "Neighbor count" that includes "Neighbors within particle's radius", but I'm not sure how to get it to work. I thought maybe that test would be avaialble in the filterss section of the Instane Material operator, but alas, it is not.

So how do I test it for neighbors, change its material, then continue with the flow?

I appreciate any help, I've included screenshots for reference. Please don't laugh at my flows, lol.

[Image: U5ag0UA.jpg]
  Reply
#2
You can use a Property Test to send to an event with one matID when particles are within the desired range, then back to another even with another matID when they leave the range. Looping events like that is not a problem.
  Reply
#3
Thanks for helping me, I really appreciate it and it's super helpful while I'm learning.

I looked at what you said, along with taking a hard look at my events and thought it would make sense to move the Property Test to near the end, just before the Mesh and Display operators. I thought this made sense because it can step through all the collisions/forces/etc and only needs test the property before it displays it. Please correct me if I'm wrong!

Anyways, I feel like I have it set up (mostly) correct now, but... still doesn't change the material.

I have the search info enabled, so I can see it should register the neighbor. I created a multi-material with grey in ID1 and red in ID2 and have it assigned in the beginning Instance Material. I've disabled the second Property Test because I thought it would be redundant (it's if it didn't pass the first test, then it would be grey).

Would you mind taking one more look and see what I'm not doing right?

Thanks a heap Smile

-stu

Edited to add the file if it helps.    
.max   PropertyTest_ChangeColor.max (Size: 3.29 MB / Downloads: 116)

[Image: S2g2bks.jpg]
  Reply
#4
Your current Property Test condition will never be satisfied ("neighbors within particle's radius"), because that would entail that a particle (the center point of any given cup) is within the boundary of another particle's search radius...but your cups collide with each other and don't interpenetrate like that. Switch to "particle and neighbor radii overlap" and the condition will be met.
  Reply
#5
(05-20-2024, 08:07 PM)tyFlow Wrote: Your current Property Test condition will never be satisfied ("neighbors within particle's radius"), because that would entail that a particle (the center point of any given cup) is within the boundary of another particle's search radius...but your cups collide with each other and don't interpenetrate like that. Switch to "particle and neighbor radii overlap" and the condition will be met.

omg, that makes so much sense...

Am I right in thinking I don't need the second Property Test as it will just continue past the first test if it fails? nm


Thanks again, and keep up the great work!

[Image: U3yyshYY8hYMNqgllg.webp]

Just to follow up, this is what my final flow looks like:

[Image: 3xQZvNW.jpg]
  Reply


Forum Jump: