Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  multiple colliders detection problem
#7
(22-11-2021, 02:39 PM)josemendez Wrote: I'm unable to reproduce this.

Used the RopeShowcase sample scene as a basis, made all 3 objects at the front into triggers and nested them. All 3 are detected and change colors properly:

[Image: wjFgt86.png]


This is the code being used, which is very similar to yours. Note I do check for contact distance and discard speculative contacts, yours doesn't (not sure if this is intentional). Also instead of filtering by tag, I just placed a component on the objects and call a method on it:

Code:
Oni.Contact[] contacts = e.contacts.Data;
for(int i = 0; i < e.contacts.Count; ++i)
        {
            Oni.Contact c = contacts[i];
            // make sure this is an actual contact:
            if (c.distance < 0.01f)
            {
                // get the collider:
                var col = colliderWorld.colliderHandles[c.bodyB].owner;

                if (col != null)
                                {
                    // make it blink:
                    Blinker blinker = col.GetComponent<Blinker>();
    
                    if (blinker)
                        blinker.Blink();
                }
            }
}

Without more info I don't think I can help you further. The code is really simple so it should work. Are there other components/scripts in your scene which might be interferring?

Ok, I found problem. It is in my code.
Reply


Messages In This Thread
RE: multiple colliders detection problem - by greyhawk - 22-11-2021, 03:32 PM