particle systems - destroy/remove individual particles manually ? aka not by time..

Greetings,

Is it possible to remove individual particles from a Particle System but not dependent on time?

I know when you create a Particle System, you can designate the time before particles are destroyed.

But I want to destroy particles (not the entire system) based on their individual locations vs another objects location (I’m trying to develop an endless runner with water via liquid fun)… But running into a few obstacles such as this :ph34r:

Thanks

Hi @henson802,

I think we might be getting some cross-topic confusion here (not uncommon in this case). Are you speaking about “particles” as a solely  visual particle system related to “display.newEmitter()”? OR, are you talking about “particles” as part of a physical system related to “physics.newParticleSystem()” and LiquidFun?

Despite the commonality of the term “particle” in each of these realms, they’re 2 completely different things and must be treated as separate un-related animals. :slight_smile:

Brent

Hey @Brent Sorrentino,

This would be the “physics.newParticleSystem()” and LiquidFun.

Basically I was thinking about having an endless runner where ObjectA is the runner - going horizontally. 

Using the Perspective library, it’d be possible for ObjectA to go forever in the right direction.

The particles would be part of a water system that is also endless.  So my theory was when ObjectA got a certain Xdistance from (IndividualParticle) - it’d delete that individual particle, to save on memory…  But I’m starting to believe this may not be possible to ascertain individual particles and their location.  I don’t want to delete the entire system.

Also - with ParticleSystem - individual particles from two separate systems won’t interact/collide with each other correct?

Hi again,

How about using the “:destroyParticles()” call, with a defined region somewhere around “ObjectA”?

https://docs.coronalabs.com/api/type/ParticleSystem/destroyParticles.html

Hmm this has me thinking…

Can I ‘move’ the region as if it’s a display object?

So I’m using the Perspective Library which helps with the scrolling stuff.  ObjectA is being ‘followed’ by the Perspective Camera. 

To make this work as I imagine, I’d have to update the Region location to always be xDistance from ObjectA (just off screen so it’ll destroy the particles as ObjectA moves right and the particles go off screen left)…

Cause if I don’t put the Region in the camera/perspective group, then it won’t destroy the particles right?  Because the Particle System would be part of the Camera/Perspective group… In my head trying to figure out how the Perspective Library works in terms of coordinates.  If you follow ObjectA, and it moves right… then ObjectA.x will increase.  Would this mean the other objects in camera/perspective group that are NOT being followed have their X-location decrease or remain the same… ?

Sorry if this is too complicated - I’ll try to figure this out.

Thanks Brent for the input, appreciate it

@Brent Sorrentino

This seems to be a good solution for what I need… I’m using a Runtime Enterframe then updating the Destroy Region box X position based on ( ObjectA.x - screenW ) — so as ObjectA.x moves along the x-axis to the right and camera follows (using perspective library), particles that go off screen are getting removed… 

Well that’s one obstacle solved, a few more to go but that was a major help.

Thanks, until next time… :wink:

Hi @henson802,

I think we might be getting some cross-topic confusion here (not uncommon in this case). Are you speaking about “particles” as a solely  visual particle system related to “display.newEmitter()”? OR, are you talking about “particles” as part of a physical system related to “physics.newParticleSystem()” and LiquidFun?

Despite the commonality of the term “particle” in each of these realms, they’re 2 completely different things and must be treated as separate un-related animals. :slight_smile:

Brent

Hey @Brent Sorrentino,

This would be the “physics.newParticleSystem()” and LiquidFun.

Basically I was thinking about having an endless runner where ObjectA is the runner - going horizontally. 

Using the Perspective library, it’d be possible for ObjectA to go forever in the right direction.

The particles would be part of a water system that is also endless.  So my theory was when ObjectA got a certain Xdistance from (IndividualParticle) - it’d delete that individual particle, to save on memory…  But I’m starting to believe this may not be possible to ascertain individual particles and their location.  I don’t want to delete the entire system.

Also - with ParticleSystem - individual particles from two separate systems won’t interact/collide with each other correct?

Hi again,

How about using the “:destroyParticles()” call, with a defined region somewhere around “ObjectA”?

https://docs.coronalabs.com/api/type/ParticleSystem/destroyParticles.html

Hmm this has me thinking…

Can I ‘move’ the region as if it’s a display object?

So I’m using the Perspective Library which helps with the scrolling stuff.  ObjectA is being ‘followed’ by the Perspective Camera. 

To make this work as I imagine, I’d have to update the Region location to always be xDistance from ObjectA (just off screen so it’ll destroy the particles as ObjectA moves right and the particles go off screen left)…

Cause if I don’t put the Region in the camera/perspective group, then it won’t destroy the particles right?  Because the Particle System would be part of the Camera/Perspective group… In my head trying to figure out how the Perspective Library works in terms of coordinates.  If you follow ObjectA, and it moves right… then ObjectA.x will increase.  Would this mean the other objects in camera/perspective group that are NOT being followed have their X-location decrease or remain the same… ?

Sorry if this is too complicated - I’ll try to figure this out.

Thanks Brent for the input, appreciate it

@Brent Sorrentino

This seems to be a good solution for what I need… I’m using a Runtime Enterframe then updating the Destroy Region box X position based on ( ObjectA.x - screenW ) — so as ObjectA.x moves along the x-axis to the right and camera follows (using perspective library), particles that go off screen are getting removed… 

Well that’s one obstacle solved, a few more to go but that was a major help.

Thanks, until next time… :wink: