Can I apply collision filters to a Liquid Fun particle system?

Can I apply collision filters to Liquid Fun particle systems?  I think the answer is “no” but with all the clever minds floating around the forum I wouldn’t be surprised it someone had a decent workaround.

The workaround from this other forum thread wouldn’t really be effective for my app and I could’t find any references to collision filters on the Liquid Fun site.

Basically, I want the liquid fun particle system to behave like Box2D physics objects and apply collision filters to them to control what they are allowed to interact with.

Hi @sporkfin,

In terms of “what they are allowed to interact with” can you be more detailed? Do you simply want to detect if a certain particle should trigger a “particleCollision” event with some objects but not others? Or do you want to completely void certainl particles from making contact (thus passing through, like a sensor) some other physical objects?

Brent

Thanks @Brent

I would like to void certain particles from making contact with certain other objects and particles (like a sensor).

A similar scenario to what I’m trying to accomplish would be a world where there are blue fish, red fish and yellow fish.  All the fish can physically interact with one another but only interact with particles of food that are the same color they are.  Particle that don’t match the color of the fish they are “touching” would just pass through the fish as if one of them were a sensor.

OK, so in this scenario, are the “fish” all LiquidFun particles? Or do you want particles to potentially pass through other non-particle objects?

Particles voiding (passing through) other objects in a physics-contact-like manner is a feature which doesn’t exist at the moment, but there may be a logged feature request for it which you could add votes to.

As for particles of a certain color (or whatever) not interacting with other particles based on some conditional logic, I’m pretty sure that’s not possible, but I could be wrong (or there may be some clever workaround to accomplish it). I think the basic concept is “liquid is liquid” and you can’t just have some liquids pass through other liquids or something like that, as if one substance was gas and another ice.

Brent

Thanks Brent.

I have a few more tricks to try but if they don’t work, I can live with the current system.

Hi @sporkfin,

OK, let me know how it goes. If your intention isn’t necessarily “pass through” but rather just choosing (via logic) whether a code block runs based on some properties of the particles and what they’re colliding with, that should be possible.

Brent

Cool, I’ll play around with LF particles to see which properties I can read.  I’ll try to dissect them with print_r functions unless you know off hand which property values are accessible during collisions?

Lucky you! We have just the list you need: :slight_smile:

https://docs.coronalabs.com/api/event/particleCollision/index.html

Thanks!  This time around I actually read the Important section

:)  I’m all set now.

Important

When implementing particle collisions, you must set the “fixtureContactListener” flag for each generated particle or particle group. If this flag is omitted, you will not receive particle collision responses.

So, there is no way to add a collision filter to a particle system? This means that particles will collide with all physics objects in the scene. Isn’t this very restricting? In our case, we don’t want to receive any collision events from the particles. We simply want to choose which objects our particles are colliding with. Note that the objects that we want the particles to pass through, cannot be sensors because these objects must collide with other objects. Any ideas?

Hi @sporkfin,

In terms of “what they are allowed to interact with” can you be more detailed? Do you simply want to detect if a certain particle should trigger a “particleCollision” event with some objects but not others? Or do you want to completely void certainl particles from making contact (thus passing through, like a sensor) some other physical objects?

Brent

Thanks @Brent

I would like to void certain particles from making contact with certain other objects and particles (like a sensor).

A similar scenario to what I’m trying to accomplish would be a world where there are blue fish, red fish and yellow fish.  All the fish can physically interact with one another but only interact with particles of food that are the same color they are.  Particle that don’t match the color of the fish they are “touching” would just pass through the fish as if one of them were a sensor.

OK, so in this scenario, are the “fish” all LiquidFun particles? Or do you want particles to potentially pass through other non-particle objects?

Particles voiding (passing through) other objects in a physics-contact-like manner is a feature which doesn’t exist at the moment, but there may be a logged feature request for it which you could add votes to.

As for particles of a certain color (or whatever) not interacting with other particles based on some conditional logic, I’m pretty sure that’s not possible, but I could be wrong (or there may be some clever workaround to accomplish it). I think the basic concept is “liquid is liquid” and you can’t just have some liquids pass through other liquids or something like that, as if one substance was gas and another ice.

Brent

Thanks Brent.

I have a few more tricks to try but if they don’t work, I can live with the current system.

Hi @sporkfin,

OK, let me know how it goes. If your intention isn’t necessarily “pass through” but rather just choosing (via logic) whether a code block runs based on some properties of the particles and what they’re colliding with, that should be possible.

Brent

Cool, I’ll play around with LF particles to see which properties I can read.  I’ll try to dissect them with print_r functions unless you know off hand which property values are accessible during collisions?

Lucky you! We have just the list you need: :slight_smile:

https://docs.coronalabs.com/api/event/particleCollision/index.html

Thanks!  This time around I actually read the Important section

:)  I’m all set now.

Important

When implementing particle collisions, you must set the “fixtureContactListener” flag for each generated particle or particle group. If this flag is omitted, you will not receive particle collision responses.

So, there is no way to add a collision filter to a particle system? This means that particles will collide with all physics objects in the scene. Isn’t this very restricting? In our case, we don’t want to receive any collision events from the particles. We simply want to choose which objects our particles are colliding with. Note that the objects that we want the particles to pass through, cannot be sensors because these objects must collide with other objects. Any ideas?