Obi Official Forum
Help Collide once - Printable Version

+- Obi Official Forum (http://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (http://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (http://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Collide once (/thread-2503.html)



Collide once - joshuajames1 - 21-09-2020

So I have a box collider and it's set to isTrigger= true, and eveytime the rope passes through to it, it will increase your score. It works but sometimes it's getting called twice. I just want it to work like OnTriggerEnter.


RE: Collide once - josemendez - 21-09-2020

(21-09-2020, 07:00 AM)joshuajames1 Wrote: So I have a box collider and it's set to isTrigger= true, and eveytime the rope passes through to it, it will increase your score. It works but sometimes it's getting called twice. I just want it to work like OnTriggerEnter.

Obi provides access to the full contact list every frame. Any further contact processing/filtering is your responsibility.

So, if a particle is inside a collider for say, 10 frames, a contact between a rope particle and the collider will appear in the list for 10 frames. Getting a behavior similar to OnTriggerEnter is trivial though: use a bool value to detect a frame during which a contact between the rope and the collider is present, that wasn't present the previous frame.