Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi.ObiCollider.idToCollider gone in update
#1
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.
Reply
#2
(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;
Reply