Obi Official Forum

Full Version: Obi.ObiCollider.idToCollider gone in update
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just updated from 5.3 and so far the changes look amazing, especially with the back-ends but I used:


Code:
Component collider;
if (ObiCollider.idToCollider.TryGetValue(e.contacts.Data[i].other,out collider)){

    // Function to do when particle collides with collider

}
This is scrapped in the new updates. I see the new CollisionEventHandler class but I'm wondering how can get the other collider from the contacts.Data[i].other field.
(05-12-2020, 11:21 PM)VirtualCucumber Wrote: [ -> ]I just updated from 5.3 and so far the changes look amazing, especially with the back-ends but I used:


Code:
Component collider;
if (ObiCollider.idToCollider.TryGetValue(e.contacts.Data[i].other,out collider)){

    // Function to do when particle collides with collider

}
This is scrapped in the new updates. I see the new CollisionEventHandler class but I'm wondering how can get the other collider from the contacts.Data[i].other field.

Hi there,

contacts.Data[i].other is now just an index into the ObiColliderWorld's colliderHandles array. Retrieving a collider no longer involves looking it up in a dictionary. Quoting from the manual:
http://obi.virtualmethodstudio.com/tutor...sions.html

Retrieving the collider involved in a contact

You can get a reference to the collider involved in any contact by doing:

Code:
ObiColliderBase collider = ObiColliderWorld.GetInstance().colliderHandles[contact.other].owner;