Obi Official Forum

Full Version: Retrieving contacts count only from a specific collision
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey there! Hope you are all doing well!

I am using Obi fluid. I know that we could receive a contacts count with 
Code:
e.contacts.Count
But it gives all current collision points. My question is there any chance to receive contacts count only for a specific collider? For example, the full count is 1000 and for a collider_1 the count is 300, for a collider_2 the count is 450, etc.

I am interested only in OnCollision event(simplex-collider).

Thank you!
You can count how many contacts reference a specific collider yourself. Simply check the collider referenced by each contact and if it's the one you're interested in, increase a counter. This is what is done in the FluidMaze sample scene to determine if the fluid is in contact with specific dye blocks.

See "Retrieving the collider involved in a contact" in the manual's scripting section:

http://obi.virtualmethodstudio.com/manua...sions.html

You can also take a look at the sample script you'll find at the very end of that page. It checks if fluid is in contact with a specific trigger collider (by comparing its tag), and if so, accelerate particles in a direction opposite to gravity (effectively creating a zero-G zone).
Thank you for the quick response! Yep, it seems like I just missed this part!