Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How detect amount of fluid in a container
#5
(17-10-2019, 07:02 AM)josemendez Wrote: Hi,

Subscribe to contact callbacks to detect particles inside a trigger collider. See:
http://obi.virtualmethodstudio.com/tutor...sions.html

Hi there,

Since this awesome asset is new to me, I'm still learning its depth therefore I kindly ask you to bear with me as I'm just going to let my thoughts out...

Is there any option to subscribe only to a specific collision layer, i.e. "Bucket" ? - or is there any "collision matrix" like the Unity's "Layer Collision Matrix"? 
... as per the documentation under "Scripting Collisions" I'm receiving all the particle contacts/collisions and having to call :

Code:
foreach (Oni.Contact contact in currentContacts)
{
    Component coll;
    if (ObiCollider.idToCollider.TryGetValue(contact.other, out coll))
    {
        if (coll.gameObject.layer != 11) // Layer I want to check against
            continue;

        // ... Rest of the code ...
    }
}

And with 1000 particles I get approximately 10-15k iterations which seems a bit of overkill.

Am I missing something or this is the only way to do it?
Reply


Messages In This Thread
RE: How detect amount of fluid in a container - by N0Skillz - 15-01-2020, 10:07 AM