Detect when cloth removed from trigger - 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: Detect when cloth removed from trigger (/thread-1324.html) |
Detect when cloth removed from trigger - neecko - 18-08-2019 Hello, Looking for some help. I read the docs, but still trying to wrap my head around achieving this. I have tried collision callbacks, but this lags real bad with what I'm trying to do. Simply all I want to do is detect if the cloth has exited or is no longer touching a simple trigger. I don't want it to interact with it in any other way. So the green is the cloth. If it is moved off the black box an event is called like ontriggerexit or something of the like. also on a quick side note, is there a way to detect when and if the cloth was torn? thanks! RE: Detect when cloth removed from trigger - josemendez - 19-08-2019 (18-08-2019, 06:07 PM)neecko Wrote: Hello, Hi there, Collision callbacks are the only way to get feedback on particle-collider inside/outside status. Keep track of a simple boolean value. Set it to true when any particle in the cloth is inside the trigger, set it to false when no particle is inside the trigger. When setting it to false, check if it was true before, in that case you know the cloth was inside the trigger but went out during the current frame. To detect tear events, simply subscribe to the cloth's OnConstraintTorn event. RE: Detect when cloth removed from trigger - neecko - 19-08-2019 (19-08-2019, 01:56 PM)josemendez Wrote: Hi there, Thanks for getting back to me! Really great asset by the way. Interesting. I was having a lot of lag because of what i'm trying to accomplish. Lots of collisions happening with a sticky material. Any suggestions on streamlining that or only getting collisions getting called at the vertices? Ah... Easy enough about the tears. Thank you. |