Obi Official Forum
Help Destroy Obi Particles within Radius - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Help Destroy Obi Particles within Radius (/thread-513.html)



Destroy Obi Particles within Radius - AntLewis - 02-04-2018

Hey there, once Obi particles have been emitted, is there anyway to destroy all of them within a 2D radius of an object ?

Thanks for any help!


RE: Destroy Obi Particles within Radius - AntLewis - 03-04-2018

(02-04-2018, 07:22 PM)AntLewis Wrote: Hey there, once Obi particles have been emitted, is there anyway to destroy all of them within a 2D radius of an object ?

Thanks for any help!

So....I've used the code found here, and by pressing a button to increase the radius of a CircleCollider2D it seems to deliver the effect I'm after. However, ideally this would work with trigger colliders which Obi does apparently support:

http://obi.virtualmethodstudio.com/forum/archive/index.php?thread-5.html

But when I flag the collider as a trigger it stops working - is there anything else I need to change?

Thanks


RE: Destroy Obi Particles within Radius - josemendez - 04-04-2018

(03-04-2018, 09:59 PM)AntLewis Wrote: So....I've used the code found here, and by pressing a button to increase the radius of a CircleCollider2D it seems to deliver the effect I'm after. However, ideally this would work with trigger colliders which Obi does apparently support:

http://obi.virtualmethodstudio.com/forum/archive/index.php?thread-5.html

But when I flag the collider as a trigger it stops working - is there anything else I need to change?

Thanks

Hi,

We cannot reproduce the issue. Turning any collider into a trigger still generates contacts for us. Can you post the exact code you're using? It is exactly the same as in the post you linked?


RE: Destroy Obi Particles within Radius - AntLewis - 04-04-2018

(04-04-2018, 08:22 AM)josemendez Wrote: Hi,

We cannot reproduce the issue. Turning any collider into a trigger still generates contacts for us. Can you post the exact code you're using? It is exactly the same as in the post you linked?

Hi there, thanks for the response. So I resolved the issue with the trigger not generating contacts (the script auto added a solver but I was using another one that I'd created in the scene). So now particles from the emitter will be destroyed on contact with a collider marked as trigger.

However, there's still an issue remaining that you might be able to help me with. When I press a key, I am scaling the size of the boxcollider2D ( the green outline is the collider that is being scaled).  When the boxcollider2D is not a trigger, the collider destroys particles when it scales and as it comes into contact with them (as expected). However, when it's marked as a trigger they are NOT destroyed when the boxcollider2D is scaled. So to clarify - I can fire particles at the box marked as a trigger and they are destroyed, but when a trigger collider is scaled up it does not destroy the particles (but unchecking the trigger flag makes it work).

I'm unsure why there is a difference in behaviour?


RE: Destroy Obi Particles within Radius - josemendez - 05-04-2018

(04-04-2018, 08:25 PM)AntLewis Wrote: Hi there, thanks for the response. So I resolved the issue with the trigger not generating contacts (the script auto added a solver but I was using another one that I'd created in the scene). So now particles from the emitter will be destroyed on contact with a collider marked as trigger.

However, there's still an issue remaining that you might be able to help me with. When I press a key, I am scaling the size of the boxcollider2D ( the green outline is the collider that is being scaled).  When the boxcollider2D is not a trigger, the collider destroys particles when it scales and as it comes into contact with them (as expected). However, when it's marked as a trigger they are NOT destroyed when the boxcollider2D is scaled. So to clarify - I can fire particles at the box marked as a trigger and they are destroyed, but when a trigger collider is scaled up it does not destroy the particles (but unchecking the trigger flag makes it work).

I'm unsure why there is a difference in behaviour?

Hi,

I can't reproduce this either. Scaling a trigger works as intended for me.

Are you maybe changing its size instead of scaling? If this is the case, try altering its position/scale/rotation slightly too and see if this works. It might be a known bug in which changing the collider's properties without changing its transform fails to update the internal representation of the collision grid.


RE: Destroy Obi Particles within Radius - AntLewis - 08-04-2018

(05-04-2018, 09:28 AM)josemendez Wrote: Hi,

I can't reproduce this either.  Scaling a trigger works as intended for me.

Are you maybe changing its size instead of scaling? If this is the case, try altering its position/scale/rotation slightly too and see if this works. It might be a known bug in which changing the collider's properties without changing its transform fails to update the internal representation of the collision grid.

That was exactly what I was doing - works a treat now, thanks for the superb support!