Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Detect when cloth removed from trigger
#1
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.
[Image: CBuVHY2.png]
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!
Reply
#2
(18-08-2019, 06:07 PM)neecko Wrote: 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.
[Image: CBuVHY2.png]
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!

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.
Reply
#3
(19-08-2019, 01:56 PM)josemendez Wrote: 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.

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. Sonrisa
Reply