Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  multiple colliders detection problem
#6
(22-11-2021, 02:29 PM)greyhawk Wrote: Yes, both have obicollider component. The weird thing is that when i turn off the nearMiss collider it can see the saw collider. But when the two are together, rope only sees the outermost collider, which is the first contact.

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?
Reply


Messages In This Thread
RE: multiple colliders detection problem - by josemendez - 22-11-2021, 02:39 PM