Obi Official Forum
How to code function to get collided gameobject? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html)
+--- Thread: How to code function to get collided gameobject? (/thread-213.html)



How to code function to get collided gameobject? - skywaver - 27-10-2017

Hello. Thanks for nice physic plugin.

I need to detect gameobject which collides with Obi cloth, Obi tearable cloth.

I searched and found this:

[url=http://obi.virtualmethodstudio.com/tutorials/scriptingcollisions.html]

I'm not skilled on Obi cloth, so can I ask how to code function to get collided gameobject?

Thanks in advance SonrisaSonrisa


RE: How to code function to get collided gameobject? - josemendez - 27-10-2017

(27-10-2017, 09:09 AM)skywaver Wrote: Hello. Thanks for nice physic plugin.

I need to detect gameobject which collides with Obi cloth, Obi tearable cloth.

I searched and found this:

[url=http://obi.virtualmethodstudio.com/tutorials/scriptingcollisions.html]

I'm not skilled on Obi cloth, so can I ask how to code function to get collided gameobject?

Thanks in advance SonrisaSonrisa

It's right there in the link:


Code:
Collider collider;
if (ObiCollider.idToCollider.TryGetValue(contact.other,out collider)){
// do anything you want with "collider"
}

cheers!